fix(test-runner): do not require esModuleInterop=true (#7100)

This commit is contained in:
Max Schmitt 2021-06-14 12:58:10 -07:00 committed by GitHub
parent 604cf2b89f
commit a3a9ccad6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 2 deletions

View File

@ -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': `

View File

@ -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;
});

View File

@ -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>;