test: fix should not transform external for newer Node versions

This commit is contained in:
Dmitry Gozman 2024-12-13 16:28:34 +00:00
parent b0cec5b351
commit 8f07344f0f

View file

@ -143,12 +143,13 @@ test('should not transform external', async ({ runInlineTest }) => {
}); });
`, `,
'a.spec.ts': ` 'a.spec.ts': `
import { test, expect } from '@playwright/test'; const { test, expect, Page } = require('@playwright/test');
let page: Page;
test('succeeds', () => {}); test('succeeds', () => {});
` `
}); });
expect(result.exitCode).toBe(1); 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]) { for (const type of ['module', undefined]) {