Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore: remove node version checks from esm tests (#23031)
Pavel Feldman2fc6341841eb
diff --git a/tests/playwright-test/esm.spec.ts b/tests/playwright-test/esm.spec.tsindex 641b27765b..48f1d0bfa6 100644--- a/tests/playwright-test/esm.spec.ts+++ b/tests/playwright-test/esm.spec.ts@@ -35,9 +35,7 @@ test('should load nested as esm when package.json has type module', async ({ runexpect(result.passed).toBe(1);});-test('should support import assertions', async ({ runInlineTest, nodeVersion }) => {- // We only support experimental esm mode on Node 16+- test.skip(nodeVersion.major < 16);+test('should support import assertions', async ({ runInlineTest }) => {const result = await runInlineTest({'playwright.config.ts': `import packageJSON from './package.json' assert { type: 'json' };@@ -57,9 +55,7 @@ test('should support import assertions', async ({ runInlineTest, nodeVersion })expect(result.passed).toBe(1);});-test('should import esm from ts when package.json has type module in experimental mode', async ({ runInlineTest, nodeVersion }) => {- // We only support experimental esm mode on Node 16+- test.skip(nodeVersion.major < 16);+test('should import esm from ts when package.json has type module in experimental mode', async ({ runInlineTest }) => {const result = await runInlineTest({'playwright.config.ts': `import * as fs from 'fs';@@ -91,9 +87,7 @@ test('should import esm from ts when package.json has type module in experimentaexpect(result.exitCode).toBe(0);});-test('should propagate subprocess exit code in experimental mode', async ({ runInlineTest, nodeVersion }) => {- // We only support experimental esm mode on Node 16+- test.skip(nodeVersion.major < 16);+test('should propagate subprocess exit code in experimental mode', async ({ runInlineTest }) => {const result = await runInlineTest({'package.json': JSON.stringify({ type: 'module' }),'a.test.ts': `@@ -107,9 +101,7 @@ test('should propagate subprocess exit code in experimental mode', async ({ runIexpect(result.exitCode).toBe(1);});-test('should respect path resolver in experimental mode', async ({ runInlineTest, nodeVersion }) => {- // We only support experimental esm mode on Node 16+- test.skip(nodeVersion.major < 16);+test('should respect path resolver in experimental mode', async ({ runInlineTest }) => {const result = await runInlineTest({'package.json': JSON.stringify({ type: 'module' }),'playwright.config.ts': `@@ -143,10 +135,8 @@ test('should respect path resolver in experimental mode', async ({ runInlineTestexpect(result.exitCode).toBe(0);});-test('should use source maps', async ({ runInlineTest, nodeVersion }) => {+test('should use source maps', async ({ runInlineTest }) => {test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/15202' });- // We only support experimental esm mode on Node 16+- test.skip(nodeVersion.major < 16);const result = await runInlineTest({'package.json': `{ "type": "module" }`,'playwright.config.ts': `@@ -167,9 +157,7 @@ test('should use source maps', async ({ runInlineTest, nodeVersion }) => {expect(output).toContain('[foo] › a.test.ts:4:7 › check project name');});-test('should show the codeframe in errors', async ({ runInlineTest, nodeVersion }) => {- // We only support experimental esm mode on Node 16+- test.skip(nodeVersion.major < 16);+test('should show the codeframe in errors', async ({ runInlineTest }) => {const result = await runInlineTest({'package.json': `{ "type": "module" }`,'playwright.config.ts': `@@ -209,10 +197,8 @@ test('should show the codeframe in errors', async ({ runInlineTest, nodeVersionexpect(result.output).toContain(' 11 | error.name = \'FooBarError\';');});-test('should filter by line', async ({ runInlineTest, nodeVersion }) => {+test('should filter by line', async ({ runInlineTest }) => {test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/15200' });- // We only support experimental esm mode on Node 16+- test.skip(nodeVersion.major < 16);const result = await runInlineTest({'package.json': `{ "type": "module" }`,'playwright.config.ts': `@@ -234,8 +220,7 @@ test('should filter by line', async ({ runInlineTest, nodeVersion }) => {expect(result.output).toMatch(/x\.spec\.ts.*two/);});-test('should resolve .js import to .ts file in ESM mode', async ({ runInlineTest, nodeVersion }) => {- test.skip(nodeVersion.major < 16);+test('should resolve .js import to .ts file in ESM mode', async ({ runInlineTest }) => {const result = await runInlineTest({'package.json': `{ "type": "module" }`,'playwright.config.ts': `export default { projects: [{name: 'foo'}] };`,@@ -256,8 +241,7 @@ test('should resolve .js import to .ts file in ESM mode', async ({ runInlineTestexpect(result.exitCode).toBe(0);});-test('should resolve .js import to .tsx file in ESM mode', async ({ runInlineTest, nodeVersion }) => {- test.skip(nodeVersion.major < 16);+test('should resolve .js import to .tsx file in ESM mode', async ({ runInlineTest }) => {const result = await runInlineTest({'package.json': `{ "type": "module" }`,'playwright.config.ts': `export default { projects: [{name: 'foo'}] };`,@@ -278,8 +262,7 @@ test('should resolve .js import to .tsx file in ESM mode', async ({ runInlineTesexpect(result.exitCode).toBe(0);});-test('should resolve .js import to .jsx file in ESM mode', async ({ runInlineTest, nodeVersion }) => {- test.skip(nodeVersion.major < 16);+test('should resolve .js import to .jsx file in ESM mode', async ({ runInlineTest }) => {const result = await runInlineTest({'package.json': `{ "type": "module" }`,'playwright.config.ts': `export default { projects: [{name: 'foo'}] };`,@@ -300,8 +283,7 @@ test('should resolve .js import to .jsx file in ESM mode', async ({ runInlineTesexpect(result.exitCode).toBe(0);});-test('should resolve no-extension import to .ts file in ESM mode', async ({ runInlineTest, nodeVersion }) => {- test.skip(nodeVersion.major < 16);+test('should resolve no-extension import to .ts file in ESM mode', async ({ runInlineTest }) => {const result = await runInlineTest({'package.json': `{ "type": "module" }`,'playwright.config.ts': `export default { projects: [{name: 'foo'}] };`,@@ -322,8 +304,7 @@ test('should resolve no-extension import to .ts file in ESM mode', async ({ runIexpect(result.exitCode).toBe(0);});-test('should resolve no-extension import to .tsx file in ESM mode', async ({ runInlineTest, nodeVersion }) => {- test.skip(nodeVersion.major < 16);+test('should resolve no-extension import to .tsx file in ESM mode', async ({ runInlineTest }) => {const result = await runInlineTest({'package.json': `{ "type": "module" }`,'playwright.config.ts': `export default { projects: [{name: 'foo'}] };`,@@ -344,8 +325,7 @@ test('should resolve no-extension import to .tsx file in ESM mode', async ({ runexpect(result.exitCode).toBe(0);});-test('should resolve no-extension import to .jsx file in ESM mode', async ({ runInlineTest, nodeVersion }) => {- test.skip(nodeVersion.major < 16);+test('should resolve no-extension import to .jsx file in ESM mode', async ({ runInlineTest }) => {const result = await runInlineTest({'package.json': `{ "type": "module" }`,'playwright.config.ts': `export default { projects: [{name: 'foo'}] };`,@@ -366,8 +346,7 @@ test('should resolve no-extension import to .jsx file in ESM mode', async ({ runexpect(result.exitCode).toBe(0);});-test('should resolve .js import to .tsx file in ESM mode for components', async ({ runInlineTest, nodeVersion }) => {- test.skip(nodeVersion.major < 16);+test('should resolve .js import to .tsx file in ESM mode for components', async ({ runInlineTest }) => {const result = await runInlineTest({'package.json': `{ "type": "module" }`,'playwright.config.ts': `diff --git a/tests/playwright-test/loader.spec.ts b/tests/playwright-test/loader.spec.tsindex 774e67f057..0ac5841ba6 100644--- a/tests/playwright-test/loader.spec.ts+++ b/tests/playwright-test/loader.spec.ts@@ -260,9 +260,7 @@ test('should load mts config file', async ({ runInlineTest }) => {expect(result.passed).toBe(1);});-test('should load ts from esm when package.json has type module', async ({ runInlineTest, nodeVersion }) => {- // We only support experimental esm mode on Node 16+- test.skip(nodeVersion.major < 16);+test('should load ts from esm when package.json has type module', async ({ runInlineTest }) => {const result = await runInlineTest({'playwright.config.js': `import * as fs from 'fs';@@ -442,9 +440,7 @@ test('should work with cross-imports - 2', async ({ runInlineTest }) => {expect(result.output).toContain('TEST-2');});-test('should load web server w/o esm loader in esm module', async ({ runInlineTest, nodeVersion }) => {- // We only support experimental esm mode on Node 16+- test.skip(nodeVersion.major < 16);+test('should load web server w/o esm loader in esm module', async ({ runInlineTest }) => {const result = await runInlineTest({'playwright.config.ts': `export default {@@ -769,9 +765,7 @@ test('should resolve no-extension import of module into .ts file', async ({ runIexpect(result.exitCode).toBe(0);});-test('should support node imports', async ({ runInlineTest, nodeVersion }) => {- // We only support experimental esm mode on Node 16+- test.skip(nodeVersion.major < 16);+test('should support node imports', async ({ runInlineTest }) => {const result = await runInlineTest({'playwright.config.ts': 'export default {}','package.json': JSON.stringify({@@ -820,7 +814,7 @@ test('should complain when one test file imports another', async ({ runInlineTesexpect(result.output).toContain(`test file "a.test.ts" should not import test file "b.test.ts"`);});-test('should support dynamic import', async ({ runInlineTest, nodeVersion }) => {+test('should support dynamic import', async ({ runInlineTest }) => {const result = await runInlineTest({'helper.ts': `module.exports.foo = 'foo';diff --git a/tests/playwright-test/watch.spec.ts b/tests/playwright-test/watch.spec.tsindex 2714d5275f..6d717a8075 100644--- a/tests/playwright-test/watch.spec.ts+++ b/tests/playwright-test/watch.spec.ts@@ -57,8 +57,7 @@ test('should print dependencies in CJS mode', async ({ runInlineTest }) => {});});-test('should print dependencies in ESM mode', async ({ runInlineTest, nodeVersion }) => {- test.skip(nodeVersion.major < 16);+test('should print dependencies in ESM mode', async ({ runInlineTest }) => {const result = await runInlineTest({'package.json': `{ "type": "module" }`,'playwright.config.ts': `@@ -375,8 +374,7 @@ test('should run on changed deps', async ({ runWatchTest, writeFiles }) => {await testProcess.waitForOutput('Waiting for file changes.');});-test('should run on changed deps in ESM', async ({ runWatchTest, writeFiles, nodeVersion }) => {- test.skip(nodeVersion.major < 16);+test('should run on changed deps in ESM', async ({ runWatchTest, writeFiles }) => {const testProcess = await runWatchTest({'playwright.config.ts': `export default {};`,'package.json': `{ "type": "module" }`,@@ -652,8 +650,7 @@ test('should run CT on indirect deps change', async ({ runWatchTest, writeFilesawait testProcess.waitForOutput('Waiting for file changes.');});-test('should run CT on indirect deps change ESM mode', async ({ runWatchTest, writeFiles, nodeVersion }) => {- test.skip(nodeVersion.major < 16);+test('should run CT on indirect deps change ESM mode', async ({ runWatchTest, writeFiles }) => {const testProcess = await runWatchTest({'playwright.config.ts': `import { defineConfig } from '@playwright/experimental-ct-react';