Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

chore: enable tsc for ttest sources (#21018)

Dmitry Gozman24c8d45c7054
diff --git a/packages/playwright-core/src/utils/timeoutRunner.ts b/packages/playwright-core/src/utils/timeoutRunner.ts
index 32ba38faa4..b482e3558f 100644
--- a/packages/playwright-core/src/utils/timeoutRunner.ts
+++ b/packages/playwright-core/src/utils/timeoutRunner.ts
@@ -123,9 +123,9 @@ export async function pollAgainstTimeout<T>(callback: () => Promise<{ continuePo
: await wrappedCallback().then(value => ({ result: value, timedOut: false }));
if (received.timedOut)
break;
- lastResult = received.result.result;
- if (!received.result.continuePolling)
- return { result: received.result.result, timedOut: false };
+ lastResult = (received as any).result.result;
+ if (!(received as any).result.continuePolling)
+ return { result: lastResult, timedOut: false };
const interval = pollIntervals!.shift() ?? lastPollInterval;
if (timeout !== 0 && startTime + timeout <= monotonicTime() + interval)
break;
diff --git a/tests/playwright-test/playwright.trace.spec.ts b/tests/playwright-test/playwright.trace.spec.ts
index 68a925012b..90447d07c2 100644
--- a/tests/playwright-test/playwright.trace.spec.ts
+++ b/tests/playwright-test/playwright.trace.spec.ts
@@ -15,7 +15,7 @@
*/
import { test, expect } from './playwright-test-fixtures';
-import { ZipFile } from '../../packages/playwright-core/lib/utils';
+const { ZipFile } = require('../../packages/playwright-core/lib/utils');
import fs from 'fs';
test('should stop tracing with trace: on-first-retry, when not retrying', async ({ runInlineTest }, testInfo) => {
diff --git a/tests/playwright-test/reporter-html.spec.ts b/tests/playwright-test/reporter-html.spec.ts
index abdba6ef8f..8b40898398 100644
--- a/tests/playwright-test/reporter-html.spec.ts
+++ b/tests/playwright-test/reporter-html.spec.ts
@@ -20,7 +20,7 @@ import url from 'url';
import { test as baseTest, expect, createImage } from './playwright-test-fixtures';
import type { HttpServer } from '../../packages/playwright-core/src/utils';
import { startHtmlReportServer } from '../../packages/playwright-test/lib/reporters/html';
-import { spawnAsync } from 'playwright-core/lib/utils';
+const { spawnAsync } = require('../../packages/playwright-core/lib/utils');
const test = baseTest.extend<{ showReport: (reportFolder?: string) => Promise<void> }>({
showReport: async ({ page }, use, testInfo) => {
diff --git a/tests/playwright-test/reporter-list.spec.ts b/tests/playwright-test/reporter-list.spec.ts
index 15df027d65..a79cd4830d 100644
--- a/tests/playwright-test/reporter-list.spec.ts
+++ b/tests/playwright-test/reporter-list.spec.ts
@@ -182,7 +182,7 @@ test('should truncate long test names', async ({ runInlineTest }) => {
test.skip('skipped very long name', async () => {
});
`,
- }, { reporter: 'list', retries: 0 }, { PWTEST_TTY_WIDTH: 50 });
+ }, { reporter: 'list', retries: 0 }, { PWTEST_TTY_WIDTH: '50' });
expect(result.exitCode).toBe(1);
const lines = result.output.split('\n').slice(3, 11);
diff --git a/tests/tsconfig.json b/tests/tsconfig.json
index 6e36239f7c..409252ec4f 100644
--- a/tests/tsconfig.json
+++ b/tests/tsconfig.json
@@ -18,5 +18,5 @@
},
},
"include": ["**/*.spec.js", "**/*.ts", "index.d.ts"],
- "exclude": ["playwright-test/", "components/"]
+ "exclude": ["components/"]
}