chore: remove node version checks from esm tests (#23031)

This commit is contained in:
Pavel Feldman 2023-05-16 11:07:34 -07:00 committed by GitHub
parent 137aaf0ea2
commit 2fc6341841
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 51 deletions

View file

@ -35,9 +35,7 @@ test('should load nested as esm when package.json has type module', async ({ run
expect(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 experimenta
expect(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 ({ runI
expect(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 ({ runInlineTest
expect(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, nodeVersion
expect(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 ({ runInlineTest
expect(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 ({ runInlineTes
expect(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 ({ runInlineTes
expect(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 ({ runI
expect(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 ({ run
expect(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 ({ run
expect(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': `

View file

@ -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 ({ runI
expect(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 ({ runInlineTes
expect(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';

View file

@ -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, writeFiles
await 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';