Skip to content

Commit

Permalink
cherry-pick(release-1.12): do not require esModuleInterop=true
Browse files Browse the repository at this point in the history
Cherry-Pick PR microsoft#7100 SHA a3a9cca
  • Loading branch information
mxschmitt authored and aslushnikov committed Jun 25, 2021
1 parent 226a526 commit b63094b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
25 changes: 25 additions & 0 deletions tests/playwright-test/expect.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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': `
Expand Down
2 changes: 1 addition & 1 deletion tests/playwright-test/playwright-test-fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
Expand Down
2 changes: 1 addition & 1 deletion types/testExpect.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down

0 comments on commit b63094b

Please sign in to comment.