diff --git a/tests/playwright-test/expect.spec.ts b/tests/playwright-test/expect.spec.ts index 233228bb8f899..8b5d06124a4a7 100644 --- a/tests/playwright-test/expect.spec.ts +++ b/tests/playwright-test/expect.spec.ts @@ -73,6 +73,31 @@ test('should work with default expect matchers', async ({runTSC}) => { expect(result.exitCode).toBe(0); }); +test('should work with default expect matchers and esModuleInterop=false', async ({runTSC}) => { + const result = await runTSC({ + 'a.spec.ts': ` + const { test } = pwt; + test.expect(42).toBe(42); + `, + 'tsconfig.json': JSON.stringify({ + 'compilerOptions': { + 'target': 'ESNext', + 'moduleResolution': 'node', + 'module': 'commonjs', + 'strict': true, + 'rootDir': '.', + 'esModuleInterop': false, + 'allowSyntheticDefaultImports': false, + 'lib': ['esnext', 'dom', 'DOM.Iterable'] + }, + 'exclude': [ + 'node_modules' + ] + }), + }); + expect(result.exitCode).toBe(0); +}); + test('should work with custom PlaywrightTest namespace', async ({runTSC}) => { const result = await runTSC({ 'global.d.ts': ` diff --git a/tests/playwright-test/playwright-test-fixtures.ts b/tests/playwright-test/playwright-test-fixtures.ts index 3e2fbd09fb381..4b4b6dfc63375 100644 --- a/tests/playwright-test/playwright-test-fixtures.ts +++ b/tests/playwright-test/playwright-test-fixtures.ts @@ -229,7 +229,7 @@ export const test = base.extend({ runTSC: async ({}, use, testInfo) => { let tscResult: TSCResult | undefined; await use(async files => { - const baseDir = await writeFiles(testInfo, { ...files, 'tsconfig.json': JSON.stringify(TSCONFIG) }); + const baseDir = await writeFiles(testInfo, { 'tsconfig.json': JSON.stringify(TSCONFIG), ...files }); tscResult = await runTSC(baseDir); return tscResult; }); diff --git a/types/testExpect.d.ts b/types/testExpect.d.ts index ab1935c1acc29..1dd6afe7d1fa0 100644 --- a/types/testExpect.d.ts +++ b/types/testExpect.d.ts @@ -6,7 +6,7 @@ * LICENSE file in the root directory of this source tree. */ -import type expect from 'expect'; +import type * as expect from 'expect'; import type { ExpectedAssertionsErrors } from 'expect/build/types'; export declare type AsymmetricMatcher = Record;