mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
fix(test-runner): do not require esModuleInterop=true (#7100)
This commit is contained in:
parent
604cf2b89f
commit
a3a9ccad6f
@ -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': `
|
||||
|
@ -229,7 +229,7 @@ export const test = base.extend<Fixtures>({
|
||||
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;
|
||||
});
|
||||
|
2
types/testExpect.d.ts
vendored
2
types/testExpect.d.ts
vendored
@ -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<string, any>;
|
||||
|
Loading…
x
Reference in New Issue
Block a user