test: repro enums in tsx undefined (#13272)

The enums imported from the .tsx file are ending up as "undefined";
from the .ts file they are defined.

Repro for #13265.
This commit is contained in:
Ross Wollman 2022-04-03 21:12:00 -07:00 committed by GitHub
parent 42798b5857
commit 014deed913
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -36,3 +36,43 @@ test('should succeed', async ({ runInlineTest }) => {
expect(result.passed).toBe(1);
expect(result.failed).toBe(0);
});
test('should treat enums equally', async ({ runInlineTest }) => {
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/13265' });
const result = await runInlineTest({
'component.tsx': `
export enum MyEnum {
Value = "value",
};
export const enum MyConstEnum {
Value = "value",
}
`,
'regular.ts': `
export enum MyEnum {
Value = "value",
};
export const enum MyConstEnum {
Value = "value",
}
`,
'example.spec.ts': `
const { test } = pwt;
import * as components from './component';
import * as regular from './regular';
test('works', () => {
expect.soft(components.MyEnum.Value).toBe("value");
expect.soft(components.MyConstEnum.Value).toBe("value");
expect.soft(regular.MyEnum.Value).toBe("value");
expect.soft(regular.MyConstEnum.Value).toBe("value");
})
`,
});
expect(result.exitCode).toBe(0);
expect(result.passed).toBe(1);
});