test: fix should not transform external for newer Node versions (#34006)

This commit is contained in:
Dmitry Gozman 2024-12-13 17:17:49 +00:00 committed by GitHub
parent c700a8405c
commit 258881bea1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -143,12 +143,13 @@ test('should not transform external', async ({ runInlineTest }) => {
});
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
const { test, expect, Page } = require('@playwright/test');
let page: Page;
test('succeeds', () => {});
`
});
expect(result.exitCode).toBe(1);
expect(result.output).toMatch(/(Cannot use import statement outside a module|require\(\) of ES Module .* not supported.)/);
expect(result.output).toContain(`SyntaxError: Unexpected token ':'`);
});
for (const type of ['module', undefined]) {