Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

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

Dmitry Gozman258881bea104
diff --git a/tests/playwright-test/babel.spec.ts b/tests/playwright-test/babel.spec.ts
index 517d813bc8..340fda91ad 100644
--- a/tests/playwright-test/babel.spec.ts
+++ b/tests/playwright-test/babel.spec.ts
@@ -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]) {