Skip to content

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

test: use TypeScript exports in inline .ts files (#43381)

Pavel Feldman823295883c8f
diff --git a/tests/playwright-test/access-data.spec.ts b/tests/playwright-test/access-data.spec.ts
index 4da80d8de0..ea5b984341 100644
--- a/tests/playwright-test/access-data.spec.ts
+++ b/tests/playwright-test/access-data.spec.ts
@@ -71,7 +71,7 @@ test('should access annotations in fixture', async ({ runInlineTest }) => {
test('should report projectName in result', async ({ runInlineTest }) => {
const { exitCode, report } = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'foo' },
{},
diff --git a/tests/playwright-test/basic.spec.ts b/tests/playwright-test/basic.spec.ts
index 94d6644f57..6493c9e29d 100644
--- a/tests/playwright-test/basic.spec.ts
+++ b/tests/playwright-test/basic.spec.ts
@@ -250,7 +250,7 @@ test('should focus test from one project', async ({ runInlineTest }) => {
const { exitCode, passed, skipped, failed } = await runInlineTest({
'playwright.config.ts': `
import * as path from 'path';
- module.exports = { projects: [
+ export default { projects: [
{ testDir: path.join(__dirname, 'a') },
{ testDir: path.join(__dirname, 'b') },
] };
diff --git a/tests/playwright-test/config.spec.ts b/tests/playwright-test/config.spec.ts
index c85e03041d..f8a51dd00e 100644
--- a/tests/playwright-test/config.spec.ts
+++ b/tests/playwright-test/config.spec.ts
@@ -21,7 +21,7 @@ import { test, expect } from './playwright-test-fixtures';
test('should be able to define config', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { timeout: 12345 };
+ export default { timeout: 12345 };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -38,7 +38,7 @@ test('should be able to define config', async ({ runInlineTest }) => {
test('should prioritize project timeout', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { timeout: 500, projects: [{ timeout: 10000}, {}] };
+ export default { timeout: 500, projects: [{ timeout: 10000}, {}] };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -57,7 +57,7 @@ test('should prioritize project timeout', async ({ runInlineTest }) => {
test('should prioritize command line timeout over project timeout', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [{ timeout: 10000}] };
+ export default { projects: [{ timeout: 10000}] };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -75,7 +75,7 @@ test('should prioritize command line timeout over project timeout', async ({ run
test('should support failOnFlakyTests config option', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
failOnFlakyTests: true,
retries: 1,
reporter: [['line'], ['./reporter.js']],
@@ -104,7 +104,7 @@ test('should read config from --config, resolve relative testDir', async ({ runI
const result = await runInlineTest({
'my.config.ts': `
import * as path from 'path';
- module.exports = {
+ export default {
testDir: 'dir',
};
`,
@@ -129,7 +129,7 @@ test('should read config from --config, resolve relative testDir', async ({ runI
test('should default testDir to the config file', async ({ runInlineTest }) => {
const result = await runInlineTest({
'dir/my.config.ts': `
- module.exports = {};
+ export default {};
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -153,7 +153,7 @@ test('should be able to set reporters', async ({ runInlineTest }, testInfo) => {
const reportFile = testInfo.outputPath('my-report.json');
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [
['json', { outputFile: ${JSON.stringify(reportFile)} }],
['list'],
@@ -176,7 +176,7 @@ test('should support different testDirs', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
import * as path from 'path';
- module.exports = { projects: [
+ export default { projects: [
{ testDir: __dirname },
{ testDir: 'dir' },
] };
@@ -208,7 +208,7 @@ test('should allow root testDir and use it for relative paths', async ({ runInli
const result = await runInlineTest({
'config/config.ts': `
import * as path from 'path';
- module.exports = {
+ export default {
testDir: path.join(__dirname, '..'),
projects: [{ testDir: path.join(__dirname, '..', 'dir') }]
};
@@ -239,7 +239,7 @@ test('should throw when test() is called in config file', async ({ runInlineTest
'playwright.config.ts': `
import { test, expect } from '@playwright/test';
test('hey', () => {});
- module.exports = {};
+ export default {};
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -253,7 +253,7 @@ test('should throw when test() is called in config file', async ({ runInlineTest
test('should filter by project, case-insensitive', async ({ runInlineTest }) => {
const { passed, failed, outputLines, skipped } = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'suite1' },
{ name: 'suite2' },
] };
@@ -299,7 +299,7 @@ test('should filter by project wildcard', async ({ runInlineTest }) => {
test('should print nice error when the project wildcard does not match anything', async ({ runInlineTest }) => {
const { output, exitCode } = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'suite1' },
{ name: 'suite2' },
] };
@@ -405,7 +405,7 @@ test('should match non-default project by wildcard', async ({ runInlineTest }) =
test('should print nice error when project is unknown', async ({ runInlineTest }) => {
const { output, exitCode } = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'suite1' },
{ name: 'suite2' },
] };
@@ -424,7 +424,7 @@ test('should print nice error when project is unknown and launching UI mode', as
test.setTimeout(5000);
const { output, exitCode } = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'suite1' },
{ name: 'suite2' },
] };
@@ -441,7 +441,7 @@ test('should print nice error when project is unknown and launching UI mode', as
test('should filter by project list, case-insensitive', async ({ runInlineTest }) => {
const { passed, failed, outputLines, skipped } = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'suite1' },
{ name: 'suite2' },
{ name: 'suite3' },
@@ -464,7 +464,7 @@ test('should filter by project list, case-insensitive', async ({ runInlineTest }
test('should filter when duplicate project names exist', async ({ runInlineTest }) => {
const { passed, failed, outputLines, skipped } = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'suite1' },
{ name: 'suite2' },
{ name: 'suite1' },
@@ -487,7 +487,7 @@ test('should filter when duplicate project names exist', async ({ runInlineTest
test('should print nice error when some of the projects are unknown', async ({ runInlineTest }) => {
const { output, exitCode } = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'suite1' },
{ name: 'suite2' },
] };
@@ -506,7 +506,7 @@ test('should print nice error when some of the projects are unknown', async ({ r
test('should print nice error when project name is not stable', async ({ runInlineTest }) => {
const { output, exitCode } = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: \`calculated \$\{Date.now()\}\` },
] };
`,
@@ -542,7 +542,7 @@ test('should work without config file', async ({ runInlineTest }) => {
test('should inherit use options in projects', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: { foo: 'config' },
projects: [{
use: { bar: 'project' },
@@ -566,7 +566,7 @@ test('should inherit use options in projects', async ({ runInlineTest }) => {
test('should support ignoreSnapshots config option', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
ignoreSnapshots: true,
projects: [
{ name: 'p1' },
@@ -593,7 +593,7 @@ test('should support ignoreSnapshots config option', async ({ runInlineTest }) =
test('should validate workers option set to percent', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
workers: '50%'
};
`,
@@ -610,7 +610,7 @@ test('should validate workers option set to percent', async ({ runInlineTest },
test('should throw when workers option is invalid', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
workers: ''
};
`,
@@ -627,7 +627,7 @@ test('should throw when workers option is invalid', async ({ runInlineTest }) =>
test('should throw when workers is negative via CLI (regression for #39938)', async ({ runInlineTest }) => {
const result = await runInlineTest({
- 'playwright.config.ts': `module.exports = {};`,
+ 'playwright.config.ts': `export default {};`,
'a.test.ts': `
import { test } from '@playwright/test';
test('pass', () => {});
@@ -639,7 +639,7 @@ test('should throw when workers is negative via CLI (regression for #39938)', as
test('should throw when workers is an invalid percentage via CLI (regression for #41679)', async ({ runInlineTest }) => {
const result = await runInlineTest({
- 'playwright.config.ts': `module.exports = {};`,
+ 'playwright.config.ts': `export default {};`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('fails', () => { expect(1).toBe(2); });
@@ -652,7 +652,7 @@ test('should throw when workers is an invalid percentage via CLI (regression for
test('should work with undefined values and base', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
updateSnapshots: undefined,
};
`,
@@ -839,7 +839,7 @@ test('should throw on invalid --tsconfig', async ({ runInlineTest }) => {
test('should expose process.argv as config.argv and not pollute test discovery', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {};
+ export default {};
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -859,13 +859,13 @@ test('should expose process.argv as config.argv and not pollute test discovery',
test('config.argv should be visible in globalSetup and reporter', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
globalSetup: './global-setup.ts',
reporter: './my-reporter.ts',
};
`,
'global-setup.ts': `
- module.exports = async (config) => {
+ export default async (config) => {
console.log('GLOBAL_SETUP_HAS_ARG=' + config.argv.includes('--build-path=/foo'));
};
`,
@@ -875,7 +875,7 @@ test('config.argv should be visible in globalSetup and reporter', async ({ runIn
console.log('REPORTER_HAS_ARG=' + config.argv.includes('--build-path=/foo'));
}
}
- module.exports = MyReporter;
+ export default MyReporter;
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
diff --git a/tests/playwright-test/coverage.spec.ts b/tests/playwright-test/coverage.spec.ts
index 574dd81c2c..f3a768b0f7 100644
--- a/tests/playwright-test/coverage.spec.ts
+++ b/tests/playwright-test/coverage.spec.ts
@@ -43,7 +43,7 @@ const coverageHelper = `
test('should collect istanbul coverage into the trace', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: { trace: { mode: 'on', _coverage: true } },
};
`,
@@ -85,7 +85,7 @@ test('should collect istanbul coverage into the trace', async ({ runInlineTest }
test('should aggregate coverage with the coverage reporter', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: { trace: { mode: 'on', _coverage: true } },
reporter: [['dot'], ['coverage', { outputDir: 'coverage-report' }]],
};
@@ -132,7 +132,7 @@ test('should aggregate coverage with the coverage reporter', async ({ runInlineT
test('should warn when no coverage was collected', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: { trace: { mode: 'on', _coverage: true } },
reporter: [['dot'], ['coverage', { outputDir: 'coverage-report' }]],
};
diff --git a/tests/playwright-test/deps.spec.ts b/tests/playwright-test/deps.spec.ts
index 09bd481b0b..1bf2574a38 100644
--- a/tests/playwright-test/deps.spec.ts
+++ b/tests/playwright-test/deps.spec.ts
@@ -19,7 +19,7 @@ import { test, expect } from './playwright-test-fixtures';
test('should run projects with dependencies', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'A' },
{ name: 'B', dependencies: ['A'] },
@@ -41,7 +41,7 @@ test('should run projects with dependencies', async ({ runInlineTest }) => {
test('should inherit env changes from dependencies', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'A', testMatch: '**/a.spec.ts' },
{ name: 'B', testMatch: '**/b.spec.ts', teardown: 'E' },
{ name: 'C', testMatch: '**/c.spec.ts', dependencies: ['A'] },
@@ -92,7 +92,7 @@ test('should inherit env changes from dependencies', async ({ runInlineTest }) =
test('should not run projects with dependencies when --no-deps is passed', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'A' },
{ name: 'B', dependencies: ['A'] },
@@ -114,7 +114,7 @@ test('should not run projects with dependencies when --no-deps is passed', async
test('should not run project if dependency failed', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'A' },
{ name: 'B', dependencies: ['A'] },
@@ -141,7 +141,7 @@ test('should not run project if dependency failed', async ({ runInlineTest }) =>
test('should not run project if dependency failed (2)', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'A1' },
{ name: 'A2', dependencies: ['A1'] },
@@ -167,7 +167,7 @@ test('should not run project if dependency failed (2)', async ({ runInlineTest }
test('should filter by project list, but run deps', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'A' },
{ name: 'B' },
{ name: 'C', dependencies: ['A'] },
@@ -191,7 +191,7 @@ test('should filter by project list, but run deps', async ({ runInlineTest }) =>
test('should not filter dependency by file name', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'A' },
{ name: 'B', dependencies: ['A'] },
] };
@@ -213,7 +213,7 @@ test('should not filter dependency by file name', async ({ runInlineTest }) => {
test('should filter dependency by only', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'setup', testMatch: /setup.ts/ },
{ name: 'browser', dependencies: ['setup'] },
] };
@@ -241,7 +241,7 @@ test('should filter dependency by only', async ({ runInlineTest }) => {
test('should filter dependency by only when running explicitly', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'setup', testMatch: /setup.ts/ },
{ name: 'browser', dependencies: ['setup'] },
] };
@@ -269,7 +269,7 @@ test('should filter dependency by only when running explicitly', async ({ runInl
test('should not filter dependency by only 3', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'setup', testMatch: /setup.*.ts/ },
{ name: 'browser', dependencies: ['setup'] },
] };
@@ -300,7 +300,7 @@ test('should not filter dependency by only 3', async ({ runInlineTest }) => {
test('should not report skipped dependent tests', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'setup', testMatch: /setup.ts/ },
{ name: 'browser', dependencies: ['setup'] },
] };
@@ -325,7 +325,7 @@ test('should not report skipped dependent tests', async ({ runInlineTest }) => {
test('should report circular dependencies', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'A', dependencies: ['B'] },
{ name: 'B', dependencies: ['A'] },
] };
@@ -342,7 +342,7 @@ test('should report circular dependencies', async ({ runInlineTest }) => {
test('should run dependency in each shard', async ({ runInlineTest }) => {
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'setup', testMatch: /setup.ts/ },
{ name: 'chromium', dependencies: ['setup'] },
@@ -385,7 +385,7 @@ test('should run dependency in each shard', async ({ runInlineTest }) => {
test('should run setup project with zero tests', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'setup', testMatch: /not-matching/ },
{ name: 'real', dependencies: ['setup'] },
@@ -406,7 +406,7 @@ test('should run setup project with zero tests', async ({ runInlineTest }) => {
test('should run setup project with zero tests recursively', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'A', testMatch: /a.spec/ },
{ name: 'B', testMatch: /not-matching/, dependencies: ['A'] },
@@ -434,7 +434,7 @@ test('should run setup project with zero tests recursively', async ({ runInlineT
test('should run project with teardown', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'A', teardown: 'B' },
{ name: 'B' },
@@ -455,7 +455,7 @@ test('should run project with teardown', async ({ runInlineTest }) => {
test('should run non-default dependency and teardown', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'setup', teardown: 'teardown', default: false },
{ name: 'teardown', default: false },
@@ -478,7 +478,7 @@ test('should run non-default dependency and teardown', async ({ runInlineTest })
test('should run teardown after dependents', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'A', teardown: 'E' },
{ name: 'B', dependencies: ['A'] },
@@ -502,7 +502,7 @@ test('should run teardown after dependents', async ({ runInlineTest }) => {
test('should run teardown after failure', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'A', teardown: 'D' },
{ name: 'B', dependencies: ['A'] },
@@ -529,7 +529,7 @@ test('should run teardown after failure', async ({ runInlineTest }) => {
test('should complain about teardown being a dependency', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'A', teardown: 'B' },
{ name: 'B' },
@@ -548,7 +548,7 @@ test('should complain about teardown being a dependency', async ({ runInlineTest
test('should complain about teardown having a dependency', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'A', teardown: 'B' },
{ name: 'B', dependencies: ['C'] },
@@ -567,7 +567,7 @@ test('should complain about teardown having a dependency', async ({ runInlineTes
test('should support the same teardown used multiple times', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'A', teardown: 'D' },
{ name: 'B', teardown: 'D' },
@@ -589,7 +589,7 @@ test('should support the same teardown used multiple times', async ({ runInlineT
test('should only apply --repeat-each to top-level', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'A' },
{ name: 'B', dependencies: ['A'] },
@@ -611,7 +611,7 @@ test('should only apply --repeat-each to top-level', async ({ runInlineTest }) =
test('should run teardown when all projects are top-level at run point', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'setup', teardown: 'teardown' },
{ name: 'teardown' },
@@ -633,7 +633,7 @@ test('should run teardown when all projects are top-level at run point', async (
test('should not run deps for projects filtered with grep', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'setupA', teardown: 'teardownA', testMatch: '**/hook.spec.ts' },
{ name: 'teardownA', testMatch: '**/hook.spec.ts' },
@@ -670,7 +670,7 @@ test('should not run deps for projects filtered with grep', async ({ runInlineTe
test('should allow only in dependent', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'setup', testMatch: '**/setup.ts' },
{ name: 'project', dependencies: ['setup'] },
@@ -694,7 +694,7 @@ test('should allow only in dependent', async ({ runInlineTest }) => {
test('should allow only in dependent (2)', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'setup', testMatch: '**/setup.ts' },
{ name: 'project', dependencies: ['setup'] },
diff --git a/tests/playwright-test/exit-code.spec.ts b/tests/playwright-test/exit-code.spec.ts
index 44d6238930..6fa4e6ab60 100644
--- a/tests/playwright-test/exit-code.spec.ts
+++ b/tests/playwright-test/exit-code.spec.ts
@@ -174,7 +174,7 @@ test('should respect global timeout', async ({ runInlineTest }) => {
test('should exit with code 1 if the specified folder does not exist', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { testDir: '111111111111.js' };
+ export default { testDir: '111111111111.js' };
`,
});
expect(result.exitCode).toBe(1);
@@ -184,7 +184,7 @@ test('should exit with code 1 if the specified folder does not exist', async ({
test('should exit with code 1 if passed a file name', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { testDir: 'test.spec.js' };
+ export default { testDir: 'test.spec.js' };
`,
'test.spec.js': `
`,
@@ -196,7 +196,7 @@ test('should exit with code 1 if passed a file name', async ({ runInlineTest })
test('should exit with code 0 with --pass-with-no-tests', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { testDir: 'unknown' };
+ export default { testDir: 'unknown' };
`,
}, undefined, undefined, { additionalArgs: ['--pass-with-no-tests'] });
expect(result.exitCode).toBe(0);
diff --git a/tests/playwright-test/expect-to-pass.spec.ts b/tests/playwright-test/expect-to-pass.spec.ts
index f5e4072c29..7788b2f3c8 100644
--- a/tests/playwright-test/expect-to-pass.spec.ts
+++ b/tests/playwright-test/expect-to-pass.spec.ts
@@ -117,7 +117,7 @@ test('should respect interval', async ({ runInlineTest }) => {
test('should not consume the shared toPass intervals across tests', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { expect: { toPass: { intervals: [0, 0, 0] } } };
+ export default { expect: { toPass: { intervals: [0, 0, 0] } } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
diff --git a/tests/playwright-test/expect.spec.ts b/tests/playwright-test/expect.spec.ts
index a4984c91df..57cd35b8a8 100644
--- a/tests/playwright-test/expect.spec.ts
+++ b/tests/playwright-test/expect.spec.ts
@@ -472,7 +472,7 @@ test('should support toHaveURL with baseURL from webServer', async ({ runInlineT
});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(path.join(__dirname, 'assets', 'simple-server.js'))} ${port}',
port: ${port},
diff --git a/tests/playwright-test/fixture-errors.spec.ts b/tests/playwright-test/fixture-errors.spec.ts
index 66bef7a081..ab58467675 100644
--- a/tests/playwright-test/fixture-errors.spec.ts
+++ b/tests/playwright-test/fixture-errors.spec.ts
@@ -793,7 +793,7 @@ test('should report fixture teardown error after test error', async ({ runInline
test('should throw when overriding non-option fixture in config', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: {
foo: 'overridden',
headless: true,
@@ -820,7 +820,7 @@ test('should throw when overriding non-option fixture in config', async ({ runIn
test('should throw when overriding option fixture with non-option', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {};
+ export default {};
`,
'a.spec.ts': `
import { test as base, expect } from '@playwright/test';
@@ -842,7 +842,7 @@ test('should throw when overriding option fixture with non-option', async ({ run
test('should allow overriding option both in config and in test.use block', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: {
headless: true,
},
diff --git a/tests/playwright-test/fixtures.spec.ts b/tests/playwright-test/fixtures.spec.ts
index 001f827852..8d8ddd4e7a 100644
--- a/tests/playwright-test/fixtures.spec.ts
+++ b/tests/playwright-test/fixtures.spec.ts
@@ -589,7 +589,7 @@ test('should understand worker fixture params in overrides calling base', async
});
`,
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ use: { param: 'p1' } },
{ use: { param: 'p2' } },
{ use: { param: 'p3' } },
diff --git a/tests/playwright-test/global-setup.spec.ts b/tests/playwright-test/global-setup.spec.ts
index 2b43634fad..2431a94d85 100644
--- a/tests/playwright-test/global-setup.spec.ts
+++ b/tests/playwright-test/global-setup.spec.ts
@@ -20,7 +20,7 @@ test('globalSetup and globalTeardown should work', async ({ runInlineTest }) =>
const result = await runInlineTest({
'dir/playwright.config.ts': `
import * as path from 'path';
- module.exports = {
+ export default {
testDir: '..',
globalSetup: './globalSetup',
globalTeardown: path.join(__dirname, 'globalTeardown.ts'),
@@ -28,12 +28,12 @@ test('globalSetup and globalTeardown should work', async ({ runInlineTest }) =>
};
`,
'dir/globalSetup.ts': `
- module.exports = async () => {
+ export default async () => {
console.log('\\n%%from-global-setup');
};
`,
'dir/globalTeardown.ts': `
- module.exports = async () => {
+ export default async () => {
console.log('\\n%%from-global-teardown');
};
`,
@@ -57,12 +57,12 @@ test('standalone globalTeardown should work', async ({ runInlineTest }) => {
const { results, output } = await runInlineTest({
'playwright.config.ts': `
import * as path from 'path';
- module.exports = {
+ export default {
globalTeardown: './globalTeardown.ts',
};
`,
'globalTeardown.ts': `
- module.exports = async () => {
+ export default async () => {
console.log('got my teardown');
};
`,
@@ -80,20 +80,20 @@ test('globalTeardown runs after failures', async ({ runInlineTest }) => {
const { results, output } = await runInlineTest({
'playwright.config.ts': `
import * as path from 'path';
- module.exports = {
+ export default {
globalSetup: 'globalSetup.ts',
globalTeardown: './globalTeardown.ts',
};
`,
'globalSetup.ts': `
- module.exports = async () => {
+ export default async () => {
await new Promise(f => setTimeout(f, 100));
global.value = 42;
process.env.FOO = String(global.value);
};
`,
'globalTeardown.ts': `
- module.exports = async () => {
+ export default async () => {
console.log('teardown=' + global.value);
};
`,
@@ -112,19 +112,19 @@ test('globalTeardown still runs when globalSetup times out', async ({ runInlineT
const result = await runInlineTest({
'playwright.config.ts': `
import * as path from 'path';
- module.exports = {
+ export default {
globalSetup: './globalSetup.ts',
globalTeardown: 'globalTeardown.ts',
globalTimeout: 1000,
};
`,
'globalSetup.ts': `
- module.exports = async () => {
+ export default async () => {
await new Promise(f => setTimeout(f, 10000));
};
`,
'globalTeardown.ts': `
- module.exports = async () => {
+ export default async () => {
console.log('teardown=');
};
`,
@@ -142,12 +142,12 @@ test('globalSetup should work with sync function', async ({ runInlineTest }) =>
const { passed } = await runInlineTest({
'playwright.config.ts': `
import * as path from 'path';
- module.exports = {
+ export default {
globalSetup: './globalSetup.ts',
};
`,
'globalSetup.ts': `
- module.exports = () => {
+ export default () => {
process.env.FOO = JSON.stringify({ foo: 'bar' });
};
`,
@@ -166,12 +166,12 @@ test('globalSetup error should prevent tests from executing', async ({ runInline
const { passed, output } = await runInlineTest({
'playwright.config.ts': `
import * as path from 'path';
- module.exports = {
+ export default {
globalSetup: './globalSetup.ts',
};
`,
'globalSetup.ts': `
- module.exports = () => {
+ export default () => {
throw new Error('failure in global setup!');
};
`,
@@ -195,12 +195,12 @@ test('globalSetup should throw when passed non-function', async ({ runInlineTest
const { output } = await runInlineTest({
'playwright.config.ts': `
import * as path from 'path';
- module.exports = {
+ export default {
globalSetup: './globalSetup.ts',
};
`,
'globalSetup.ts': `
- module.exports = 42;
+ export default 42;
`,
'a.test.js': `
import { test, expect } from '@playwright/test';
@@ -215,7 +215,7 @@ test('globalSetup should work with default export and run the returned fn', asyn
const { output, exitCode, passed } = await runInlineTest({
'playwright.config.ts': `
import * as path from 'path';
- module.exports = {
+ export default {
globalSetup: './globalSetup.ts',
};
`,
@@ -246,7 +246,7 @@ test('globalSetup should allow requiring a package from node_modules', async ({
const { results } = await runInlineTest({
'playwright.config.ts': `
import * as path from 'path';
- module.exports = {
+ export default {
globalSetup: 'my-global-setup'
};
`,
@@ -390,17 +390,17 @@ test('teardown after error', async ({ runInlineTest }) => {
test('globalSetup should support multiple', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
globalSetup: ['./globalSetup1.ts','./globalSetup2.ts','./globalSetup3.ts','./globalSetup4.ts'],
globalTeardown: ['./globalTeardown1.ts', './globalTeardown2.ts'],
};
`,
- 'globalSetup1.ts': `module.exports = () => { console.log('%%globalSetup1'); return () => { console.log('%%callback1'); throw new Error('kaboom'); } };`,
- 'globalSetup2.ts': `module.exports = () => console.log('%%globalSetup2');`,
- 'globalSetup3.ts': `module.exports = () => { console.log('%%globalSetup3'); return () => console.log('%%callback3'); }`,
- 'globalSetup4.ts': `module.exports = () => console.log('%%globalSetup4');`,
- 'globalTeardown1.ts': `module.exports = () => console.log('%%globalTeardown1')`,
- 'globalTeardown2.ts': `module.exports = () => { console.log('%%globalTeardown2'); throw new Error('kaboom'); }`,
+ 'globalSetup1.ts': `export default () => { console.log('%%globalSetup1'); return () => { console.log('%%callback1'); throw new Error('kaboom'); } };`,
+ 'globalSetup2.ts': `export default () => console.log('%%globalSetup2');`,
+ 'globalSetup3.ts': `export default () => { console.log('%%globalSetup3'); return () => console.log('%%callback3'); }`,
+ 'globalSetup4.ts': `export default () => console.log('%%globalSetup4');`,
+ 'globalTeardown1.ts': `export default () => console.log('%%globalTeardown1')`,
+ 'globalTeardown2.ts': `export default () => { console.log('%%globalTeardown2'); throw new Error('kaboom'); }`,
'a.test.js': `
import { test } from '@playwright/test';
@@ -430,13 +430,13 @@ test('globalSetup should support multiple', async ({ runInlineTest }) => {
test('globalTeardown runs even if callback failed', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
globalSetup: './globalSetup.ts',
globalTeardown: './globalTeardown.ts',
};
`,
- 'globalSetup.ts': `module.exports = () => { console.log('%%globalSetup'); return () => { throw new Error('kaboom'); } };`,
- 'globalTeardown.ts': `module.exports = () => console.log('%%globalTeardown')`,
+ 'globalSetup.ts': `export default () => { console.log('%%globalSetup'); return () => { throw new Error('kaboom'); } };`,
+ 'globalTeardown.ts': `export default () => console.log('%%globalTeardown')`,
'a.test.js': `
import { test } from '@playwright/test';
@@ -459,7 +459,7 @@ test('globalSetup and globalTeardown should have PLAYWRIGHT_TEST=1', async ({ ru
const result = await runInlineTest({
'playwright.config.ts': `
import * as path from 'path';
- module.exports = {
+ export default {
globalSetup: './globalSetup',
globalTeardown: './globalTeardown',
};
@@ -493,13 +493,13 @@ test('globalSetup and globalTeardown should have PLAYWRIGHT_TEST=1', async ({ ru
test('globalSetup should see filtered projects', async ({ runInlineTest }) => {
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
globalSetup: './globalSetup',
projects: [{ name: 'p1' }, { name: 'p2' }, { name: 'p3' }],
};
`,
'globalSetup.ts': `
- module.exports = async (config) => {
+ export default async (config) => {
console.log('\\n%%projects=' + config.projects.map(p => p.name).join(','));
console.log('\\n%%filteredProjects=' + config.filteredProjects.map(p => p.name).join(','));
};
diff --git a/tests/playwright-test/golden.spec.ts b/tests/playwright-test/golden.spec.ts
index 20da8174ea..fd7acaa4d1 100644
--- a/tests/playwright-test/golden.spec.ts
+++ b/tests/playwright-test/golden.spec.ts
@@ -562,7 +562,7 @@ test('should match snapshots from multiple projects', async ({ runInlineTest })
...files,
'playwright.config.ts': `
import * as path from 'path';
- module.exports = { projects: [
+ export default { projects: [
{ testDir: path.join(__dirname, 'p1') },
{ testDir: path.join(__dirname, 'p2') },
]};
@@ -666,7 +666,7 @@ test('should respect maxDiffPixels option', async ({ runInlineTest }) => {
expect((await runInlineTest({
...files,
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ expect: { toMatchSnapshot: { maxDiffPixels: ${BAD_PIXELS} } } },
]};
`,
@@ -715,7 +715,7 @@ test('should respect maxDiffPixelRatio option', async ({ runInlineTest }) => {
expect((await runInlineTest({
...files,
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ expect: { toMatchSnapshot: { maxDiffPixelRatio: ${BAD_RATIO} } } },
]};
`,
@@ -876,7 +876,7 @@ test('should respect project threshold', async ({ runInlineTest }) => {
const result = await runInlineTest({
...files,
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ expect: { toMatchSnapshot: { threshold: 0.2 } } },
]};
`,
@@ -930,7 +930,7 @@ test('should respect comparator in config', async ({ runInlineTest }) => {
const result = await runInlineTest({
...files,
'playwright.config.ts': `
- module.exports = {
+ export default {
snapshotPathTemplate: '__screenshots__/{testFilePath}/{arg}{ext}',
projects: [
{
@@ -1019,7 +1019,7 @@ test('should use snapshotDir as snapshot base directory', async ({ runInlineTest
const result = await runInlineTest({
...files,
'playwright.config.ts': `
- module.exports = {
+ export default {
snapshotDir: 'snaps',
};
`,
@@ -1038,7 +1038,7 @@ test('should use snapshotDir with path segments as snapshot directory', async ({
const result = await runInlineTest({
...files,
'playwright.config.ts': `
- module.exports = {
+ export default {
snapshotDir: 'snaps',
};
`,
@@ -1057,7 +1057,7 @@ test('should use snapshotDir with nested test suite and path segments', async ({
const result = await runInlineTest({
...files,
'playwright.config.ts': `
- module.exports = {
+ export default {
snapshotDir: 'snaps',
};
`,
@@ -1085,7 +1085,7 @@ test('should use project snapshotDir over base snapshotDir', async ({ runInlineT
});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{
name: 'foo',
@@ -1249,7 +1249,7 @@ test('should fail with missing expectations and retries', async ({ runInlineTest
const result = await runInlineTest({
...files,
'playwright.config.ts': `
- module.exports = { retries: 1 };
+ export default { retries: 1 };
`,
'a.spec.js': `
const { test, expect } = require('./helper');
@@ -1271,7 +1271,7 @@ test('should update expectations with retries', async ({ runInlineTest }, testIn
const result = await runInlineTest({
...files,
'playwright.config.ts': `
- module.exports = { retries: 1 };
+ export default { retries: 1 };
`,
'a.spec.js': `
const { test, expect } = require('./helper');
diff --git a/tests/playwright-test/list-mode.spec.ts b/tests/playwright-test/list-mode.spec.ts
index ea052d3ada..0679932499 100644
--- a/tests/playwright-test/list-mode.spec.ts
+++ b/tests/playwright-test/list-mode.spec.ts
@@ -21,7 +21,7 @@ import fs from 'fs';
test('should list tests', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [{ name: 'foo' }, {}] };
+ export default { projects: [{ name: 'foo' }, {}] };
`,
'a.test.js': `
const { test, expect } = require('@playwright/test');
@@ -47,7 +47,7 @@ test('should list tests', async ({ runInlineTest }) => {
test('should list tests to stdout when JSON reporter outputs to a file', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [{ name: 'foo' }, {}] };
+ export default { projects: [{ name: 'foo' }, {}] };
`,
'a.test.js': `
import { test, expect } from '@playwright/test';
@@ -71,18 +71,18 @@ test('globalSetup and globalTeardown should not run', async ({ runInlineTest })
const result = await runInlineTest({
'playwright.config.ts': `
import * as path from 'path';
- module.exports = {
+ export default {
globalSetup: './globalSetup',
globalTeardown: './globalTeardown.ts',
};
`,
'globalSetup.ts': `
- module.exports = () => {
+ export default () => {
console.log('Running globalSetup');
};
`,
'globalTeardown.ts': `
- module.exports = () => {
+ export default () => {
console.log('Running globalTeardown');
};
`,
@@ -113,7 +113,7 @@ test('outputDir should not be removed', async ({ runInlineTest }, testInfo) => {
const result1 = await runInlineTest({
'playwright.config.ts': `
- module.exports = { outputDir: ${JSON.stringify(outputDir)} };
+ export default { outputDir: ${JSON.stringify(outputDir)} };
`,
'a.test.js': `
import { test, expect } from '@playwright/test';
@@ -128,7 +128,7 @@ test('outputDir should not be removed', async ({ runInlineTest }, testInfo) => {
const result2 = await runInlineTest({
'playwright.config.ts': `
- module.exports = { outputDir: ${JSON.stringify(outputDir)} };
+ export default { outputDir: ${JSON.stringify(outputDir)} };
`,
'a.test.js': `
import { test, expect } from '@playwright/test';
@@ -175,14 +175,14 @@ test('should ignore .only', async ({ runInlineTest }) => {
test('should report errors with location', async ({ runInlineTest }) => {
const result = await runInlineTest({
- 'playwright.config.ts': `module.exports = { reporter: './reporter' };`,
+ 'playwright.config.ts': `export default { reporter: './reporter' };`,
'reporter.ts': `
class Reporter {
onError(error) {
console.log('%% ' + JSON.stringify(error.location));
}
}
- module.exports = Reporter;
+ export default Reporter;
`,
'a.test.js': `
const oh = '';
@@ -201,7 +201,7 @@ test('should list tests once', async ({ runInlineTest }) => {
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/27087' });
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { };
+ export default { };
`,
'a.test.js': `
const { test, expect } = require('@playwright/test');
diff --git a/tests/playwright-test/loader.spec.ts b/tests/playwright-test/loader.spec.ts
index d56077ebf9..6423c8de00 100644
--- a/tests/playwright-test/loader.spec.ts
+++ b/tests/playwright-test/loader.spec.ts
@@ -1120,18 +1120,16 @@ test('should complain when one test file imports another', async ({ runInlineTes
test('should support dynamic imports and requires of js, ts from js, ts and cjs', async ({ runInlineTest }) => {
const result = await runInlineTest({
'helper.ts': `
- const foo: string = 'foo';
- module.exports.foo = foo;
+ export const foo: string = 'foo';
`,
'helper2.ts': `
- module.exports.bar = 'bar';
+ export const bar = 'bar';
`,
'helper3.js': `
module.exports.baz = 'baz';
`,
'helper4.ts': `
- const foo: string = 'foo';
- module.exports.foo = foo;
+ export const foo: string = 'foo';
`,
'passthrough.cjs': `
module.exports.load = () => import('./helper2');
diff --git a/tests/playwright-test/max-failures.spec.ts b/tests/playwright-test/max-failures.spec.ts
index 099f60bece..b824a24525 100644
--- a/tests/playwright-test/max-failures.spec.ts
+++ b/tests/playwright-test/max-failures.spec.ts
@@ -187,7 +187,7 @@ test('max-failures should still run teardown project', async ({ runInlineTest })
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
maxFailures: 1,
projects: [
{ name: 'setup', testMatch: '**/setup.ts', teardown: 'teardown' },
diff --git a/tests/playwright-test/only-changed.spec.ts b/tests/playwright-test/only-changed.spec.ts
index 7bc7fc645c..37bf3f02de 100644
--- a/tests/playwright-test/only-changed.spec.ts
+++ b/tests/playwright-test/only-changed.spec.ts
@@ -247,7 +247,7 @@ test('should run project dependencies of changed tests', {
}, async ({ runInlineTest, git, writeFiles }) => {
await writeFiles({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'setup', testMatch: 'setup.spec.ts', },
{ name: 'main', dependencies: ['setup'] },
diff --git a/tests/playwright-test/playwright.artifacts.spec.ts b/tests/playwright-test/playwright.artifacts.spec.ts
index 1ea81bdca9..044379dc56 100644
--- a/tests/playwright-test/playwright.artifacts.spec.ts
+++ b/tests/playwright-test/playwright.artifacts.spec.ts
@@ -128,7 +128,7 @@ test('should work with screenshot: on', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
...testFiles,
'playwright.config.ts': `
- module.exports = { use: { screenshot: 'on' } };
+ export default { use: { screenshot: 'on' } };
`,
}, { workers: 1 }, { PLAYWRIGHT_NO_COPY_PROMPT: 'true' });
@@ -171,7 +171,7 @@ test('should work with screenshot: only-on-failure', async ({ runInlineTest }, t
const result = await runInlineTest({
...testFiles,
'playwright.config.ts': `
- module.exports = { use: { screenshot: 'only-on-failure' } };
+ export default { use: { screenshot: 'only-on-failure' } };
`,
}, { workers: 1 }, { PLAYWRIGHT_NO_COPY_PROMPT: 'true' });
@@ -209,7 +209,7 @@ test('should work with screenshot: on-first-failure', async ({ runInlineTest },
});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
retries: 1,
use: { screenshot: 'on-first-failure' }
};
@@ -241,7 +241,7 @@ test('should work with screenshot: only-on-failure & fullPage', async ({ runInli
});
`,
'playwright.config.ts': `
- module.exports = { use: { screenshot: { mode: 'only-on-failure', fullPage: true } } };
+ export default { use: { screenshot: { mode: 'only-on-failure', fullPage: true } } };
`,
}, { workers: 1 }, { PLAYWRIGHT_NO_COPY_PROMPT: 'true' });
expect(result.exitCode).toBe(1);
@@ -295,7 +295,7 @@ test('should work with trace: on', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
...testFiles,
'playwright.config.ts': `
- module.exports = { use: { trace: 'on' } };
+ export default { use: { trace: 'on' } };
`,
}, { workers: 1 }, { PLAYWRIGHT_NO_COPY_PROMPT: 'true' });
@@ -336,7 +336,7 @@ test('should work with trace: retain-on-failure', async ({ runInlineTest }, test
const result = await runInlineTest({
...testFiles,
'playwright.config.ts': `
- module.exports = { use: { trace: 'retain-on-failure' } };
+ export default { use: { trace: 'retain-on-failure' } };
`,
}, { workers: 1 }, { PLAYWRIGHT_NO_COPY_PROMPT: 'true' });
@@ -367,7 +367,7 @@ test('should work with trace: on-first-retry', async ({ runInlineTest }, testInf
const result = await runInlineTest({
...testFiles,
'playwright.config.ts': `
- module.exports = { use: { trace: 'on-first-retry' } };
+ export default { use: { trace: 'on-first-retry' } };
`,
}, { workers: 1, retries: 1 }, { PLAYWRIGHT_NO_COPY_PROMPT: 'true' });
@@ -408,7 +408,7 @@ test('should work with trace: on-all-retries', async ({ runInlineTest }, testInf
const result = await runInlineTest({
...testFiles,
'playwright.config.ts': `
- module.exports = { use: { trace: 'on-all-retries' } };
+ export default { use: { trace: 'on-all-retries' } };
`,
}, { workers: 1, retries: 2 }, { PLAYWRIGHT_NO_COPY_PROMPT: 'true' });
@@ -464,7 +464,7 @@ test('should work with trace: retain-on-first-failure', async ({ runInlineTest }
const result = await runInlineTest({
...testFiles,
'playwright.config.ts': `
- module.exports = { use: { trace: 'retain-on-first-failure' } };
+ export default { use: { trace: 'retain-on-first-failure' } };
`,
}, { workers: 1, retries: 2 }, { PLAYWRIGHT_NO_COPY_PROMPT: 'true' });
@@ -515,7 +515,7 @@ test('should work with trace: retain-on-failure-and-retries', async ({ runInline
const result = await runInlineTest({
...testFiles,
'playwright.config.ts': `
- module.exports = { use: { trace: 'retain-on-failure-and-retries' } };
+ export default { use: { trace: 'retain-on-failure-and-retries' } };
`,
}, { workers: 1, retries: 2 }, { PLAYWRIGHT_NO_COPY_PROMPT: 'true' });
@@ -596,7 +596,7 @@ test('error-context should use relative path in location', async ({ runInlineTes
test('should take screenshot when page is closed in afterEach', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { screenshot: 'on' } };
+ export default { use: { screenshot: 'on' } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
diff --git a/tests/playwright-test/playwright.config.spec.ts b/tests/playwright-test/playwright.config.spec.ts
index 025a160e34..6c008eff21 100644
--- a/tests/playwright-test/playwright.config.spec.ts
+++ b/tests/playwright-test/playwright.config.spec.ts
@@ -19,7 +19,7 @@ import { test, expect } from './playwright-test-fixtures';
test('should fall back to launchOptions', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: {
launchOptions: {
headless: false,
@@ -44,7 +44,7 @@ test('should fall back to launchOptions', async ({ runInlineTest }) => {
test('should override launchOptions', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: {
headless: false,
channel: 'chrome',
@@ -71,7 +71,7 @@ test('should override launchOptions', async ({ runInlineTest }) => {
test('should respect contextOptions', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: {
contextOptions: {
acceptDownloads: false,
@@ -122,7 +122,7 @@ test('should respect contextOptions', async ({ runInlineTest }) => {
test('should override contextOptions', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: {
acceptDownloads: false,
bypassCSP: true,
@@ -197,7 +197,7 @@ test('should override contextOptions', async ({ runInlineTest }) => {
test('should respect testIdAttribute', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: {
testIdAttribute: 'data-pw',
}
@@ -219,7 +219,7 @@ test('should respect testIdAttribute', async ({ runInlineTest }) => {
test('should respect testIdAttribute with multiple comma-separated names', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: {
testIdAttribute: 'data-pw,data-ti',
}
diff --git a/tests/playwright-test/playwright.connect.spec.ts b/tests/playwright-test/playwright.connect.spec.ts
index b31e15edfd..0dc8afb48f 100644
--- a/tests/playwright-test/playwright.connect.spec.ts
+++ b/tests/playwright-test/playwright.connect.spec.ts
@@ -41,7 +41,7 @@ test('should work with connectOptions', async ({ runInlineTest }) => {
`,
'global-setup.ts': `
import { chromium } from '@playwright/test';
- module.exports = async () => {
+ export default async () => {
process.env.DEBUG = 'pw:browser';
process.env.PWTEST_SERVER_WS_HEADERS =
'x-playwright-debug-log: a-debug-log-string\\r\\n' +
@@ -145,7 +145,7 @@ test('should print debug log when failed to connect', async ({ runInlineTest })
import { chromium } from '@playwright/test';
import ws from 'ws';
import http from 'http';
- module.exports = async () => {
+ export default async () => {
const server = http.createServer(() => {});
server.on('upgrade', async (request, socket, head) => {
socket.write('HTTP/1.1 401 Unauthorized\\r\\nx-playwright-debug-log: b-debug-log-string\\r\\n\\r\\nUnauthorized body');
@@ -189,7 +189,7 @@ test('should record trace', async ({ runInlineTest }) => {
`,
'global-setup.ts': `
import { chromium } from '@playwright/test';
- module.exports = async () => {
+ export default async () => {
const server = await chromium.launchServer();
process.env.CONNECT_WS_ENDPOINT = server.wsEndpoint();
process.env.DEBUG = 'pw:channel';
diff --git a/tests/playwright-test/playwright.fetch.spec.ts b/tests/playwright-test/playwright.fetch.spec.ts
index 8fe962218f..66f66324a7 100644
--- a/tests/playwright-test/playwright.fetch.spec.ts
+++ b/tests/playwright-test/playwright.fetch.spec.ts
@@ -35,7 +35,7 @@ test('should expose request fixture', async ({ runInlineTest, server }) => {
test('should use baseURL in request fixture', async ({ runInlineTest, server }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { baseURL: '${server.PREFIX}' } };
+ export default { use: { baseURL: '${server.PREFIX}' } };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -60,7 +60,7 @@ test('should stop tracing on requestContext.dispose()', async ({ runInlineTest,
});
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['html', { open: 'never' }]],
use: {
trace:'retain-on-failure'
diff --git a/tests/playwright-test/playwright.reuse.browser.spec.ts b/tests/playwright-test/playwright.reuse.browser.spec.ts
index 5a3af6921a..86543d12f1 100644
--- a/tests/playwright-test/playwright.reuse.browser.spec.ts
+++ b/tests/playwright-test/playwright.reuse.browser.spec.ts
@@ -114,7 +114,7 @@ test('should produce correct test steps', async ({ runInlineTest, runServer }) =
console.log('%% onStepEnd [' + step.category + '] ' + this.stepTitle(step));
}
}
- module.exports = Reporter;
+ export default Reporter;
`,
'src/a.test.ts': `
import { test, expect } from '@playwright/test';
diff --git a/tests/playwright-test/playwright.spec.ts b/tests/playwright-test/playwright.spec.ts
index 18d6dd18eb..829670da96 100644
--- a/tests/playwright-test/playwright.spec.ts
+++ b/tests/playwright-test/playwright.spec.ts
@@ -41,7 +41,7 @@ export class VideoPlayer {
test('should respect screen option', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { viewport: { width: 500, height: 500 }, screen: { width: 1000, height: 1000 } } };
+ export default { use: { viewport: { width: 500, height: 500 }, screen: { width: 1000, height: 1000 } } };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -67,7 +67,7 @@ test('should respect screen option', async ({ runInlineTest }) => {
test('should respect viewport option', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { viewport: { width: 800, height: 800 } } };
+ export default { use: { viewport: { width: 800, height: 800 } } };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -91,7 +91,7 @@ test('should respect viewport option', async ({ runInlineTest }) => {
test('should run in three browsers with --browser', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { viewport: { width: 800, height: 800 } } };
+ export default { use: { viewport: { width: 800, height: 800 } } };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -113,7 +113,7 @@ test('should run in three browsers with --browser', async ({ runInlineTest }) =>
test('should run in one browser with --browser', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { viewport: { width: 800, height: 800 } } };
+ export default { use: { viewport: { width: 800, height: 800 } } };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -133,7 +133,7 @@ test('should run in one browser with --browser', async ({ runInlineTest }) => {
test('should complain with projects and --browser', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [ {} ] };
+ export default { projects: [ {} ] };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -150,7 +150,7 @@ test('should complain with projects and --browser', async ({ runInlineTest }) =>
test('should override any headless option with --headed', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'a', use: { headless: true } }
] };
`,
@@ -169,7 +169,7 @@ test('should override any headless option with --headed', async ({ runInlineTest
test('should not override use:browserName without projects', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { browserName: 'webkit' } };
+ export default { use: { browserName: 'webkit' } };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -189,7 +189,7 @@ test('should not override use:browserName without projects', async ({ runInlineT
test('should override use:browserName with --browser', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { browserName: 'webkit' } };
+ export default { use: { browserName: 'webkit' } };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -209,7 +209,7 @@ test('should override use:browserName with --browser', async ({ runInlineTest })
test('should respect context options in various contexts', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { viewport: { width: 500, height: 500 } } };
+ export default { use: { viewport: { width: 500, height: 500 } } };
`,
'a.test.ts': `
import fs from 'fs';
@@ -276,7 +276,7 @@ test('should respect context options in various contexts', async ({ runInlineTes
test('should respect headless in launchPersistent', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { headless: false } };
+ export default { use: { headless: false } };
`,
'a.test.ts': `
import fs from 'fs';
@@ -303,7 +303,7 @@ test('should respect headless in launchPersistent', async ({ runInlineTest }) =>
test('should respect headless in modifiers that run before tests', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { headless: false } };
+ export default { use: { headless: false } };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -481,7 +481,7 @@ test('should report click error on sigint', async ({ interactWithTestRunner }) =
test('should work with video: retain-on-failure', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { video: 'retain-on-failure' }, name: 'chromium' };
+ export default { use: { video: 'retain-on-failure' }, name: 'chromium' };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -513,7 +513,7 @@ test('should work with video: retain-on-failure', async ({ runInlineTest }) => {
test('should work with video: on-first-retry', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { video: 'on-first-retry' }, retries: 1, name: 'chromium' };
+ export default { use: { video: 'on-first-retry' }, retries: 1, name: 'chromium' };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -556,7 +556,7 @@ test('should work with video: on-first-retry', async ({ runInlineTest }) => {
test('should work with video: on-all-retries', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { video: 'on-all-retries' }, retries: 2, name: 'chromium' };
+ export default { use: { video: 'on-all-retries' }, retries: 2, name: 'chromium' };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -584,7 +584,7 @@ test('should work with video: on-all-retries', async ({ runInlineTest }) => {
test('should work with video: retain-on-first-failure', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { video: 'retain-on-first-failure' }, retries: 1, name: 'chromium' };
+ export default { use: { video: 'retain-on-first-failure' }, retries: 1, name: 'chromium' };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -621,7 +621,7 @@ test('should work with video: retain-on-first-failure', async ({ runInlineTest }
test('should show a single test overlay when a step starts right after page creation', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { video: { mode: 'on', show: { test: { level: 'step' } } } }, name: 'chromium' };
+ export default { use: { video: { mode: 'on', show: { test: { level: 'step' } } } }, name: 'chromium' };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -641,7 +641,7 @@ test('should show a single test overlay when a step starts right after page crea
test('should work with video: retain-on-failure-and-retries', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { video: 'retain-on-failure-and-retries' }, retries: 1, name: 'chromium' };
+ export default { use: { video: 'retain-on-failure-and-retries' }, retries: 1, name: 'chromium' };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -766,7 +766,7 @@ test('should pass fixture defaults to tests', async ({ runInlineTest }) => {
test('should not throw with many fixtures set to undefined', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: {
+ export default { use: {
browserName: undefined,
headless: undefined,
channel: undefined,
diff --git a/tests/playwright-test/playwright.trace.spec.ts b/tests/playwright-test/playwright.trace.spec.ts
index 497ef2132c..8994742c27 100644
--- a/tests/playwright-test/playwright.trace.spec.ts
+++ b/tests/playwright-test/playwright.trace.spec.ts
@@ -25,7 +25,7 @@ test.describe.configure({ mode: 'parallel' });
test('should stop tracing with trace: on-first-retry, when not retrying', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { trace: 'on-first-retry' } };
+ export default { use: { trace: 'on-first-retry' } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@@ -61,7 +61,7 @@ test('should stop tracing with trace: on-first-retry, when not retrying', async
test('should record api trace', async ({ runInlineTest, server }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { trace: 'on' } };
+ export default { use: { trace: 'on' } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@@ -154,7 +154,7 @@ test('should not throw with trace: on-first-retry and two retries in the same wo
const result = await runInlineTest({
...files,
'playwright.config.ts': `
- module.exports = { use: { trace: 'on-first-retry' } };
+ export default { use: { trace: 'on-first-retry' } };
`,
'helper.ts': `
import { test as base } from '@playwright/test';
@@ -246,7 +246,7 @@ test('should not mixup network files between contexts', async ({ runInlineTest,
test('should save sources when requested', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: {
trace: 'on',
}
@@ -267,7 +267,7 @@ test('should save sources when requested', async ({ runInlineTest }, testInfo) =
test('should expand snapshots object in trace option', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: {
trace: { mode: 'on', snapshots: { dom: true, aria: true, screen: true } },
}
@@ -294,7 +294,7 @@ test('should expand snapshots object in trace option', async ({ runInlineTest },
test('should keep trace config options when forcing mode with --trace', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: {
trace: { mode: 'on-first-retry', snapshots: { dom: true, aria: true, screen: true } },
}
@@ -322,7 +322,7 @@ test('should keep trace config options when forcing mode with --trace', async ({
test('should not save sources when not requested', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: {
trace: {
mode: 'on',
@@ -346,7 +346,7 @@ test('should not save sources when not requested', async ({ runInlineTest }, tes
test('should work in serial mode', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { trace: 'retain-on-failure' } };
+ export default { use: { trace: 'retain-on-failure' } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@@ -381,7 +381,7 @@ test('should work in serial mode', async ({ runInlineTest }, testInfo) => {
test('should not override trace file in afterAll', async ({ runInlineTest, server }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { trace: 'retain-on-failure' } };
+ export default { use: { trace: 'retain-on-failure' } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@@ -436,7 +436,7 @@ test('should not override trace file in afterAll', async ({ runInlineTest, serve
test('should retain traces for interrupted tests', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { trace: 'retain-on-failure' }, maxFailures: 1 };
+ export default { use: { trace: 'retain-on-failure' }, maxFailures: 1 };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@@ -527,7 +527,7 @@ for (const mode of ['off', 'retain-on-failure', 'on-first-retry', 'on-all-retrie
test(`trace:retain-on-failure should create trace if context is closed before failure in the test`, async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { trace: 'retain-on-failure' } };
+ export default { use: { trace: 'retain-on-failure' } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@@ -547,7 +547,7 @@ test(`trace:retain-on-failure should create trace if context is closed before fa
test(`trace:retain-on-failure should create trace if context is closed before failure in afterEach`, async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { trace: 'retain-on-failure' } };
+ export default { use: { trace: 'retain-on-failure' } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@@ -569,7 +569,7 @@ test(`trace:retain-on-failure should create trace if context is closed before fa
test(`trace:retain-on-failure should create trace if request context is disposed before failure`, async ({ runInlineTest, server }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { trace: 'retain-on-failure' } };
+ export default { use: { trace: 'retain-on-failure' } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@@ -589,7 +589,7 @@ test(`trace:retain-on-failure should create trace if request context is disposed
test('should include attachments by default', async ({ runInlineTest, server }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { trace: 'on' } };
+ export default { use: { trace: 'on' } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@@ -621,7 +621,7 @@ test('should include attachments by default', async ({ runInlineTest, server },
test('should opt out of attachments', async ({ runInlineTest, server }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { trace: { mode: 'on', attachments: false } } };
+ export default { use: { trace: { mode: 'on', attachments: false } } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@@ -678,7 +678,7 @@ test('should record with custom page fixture', async ({ runInlineTest }, testInf
test('should expand expect.toPass', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { trace: { mode: 'on' } } };
+ export default { use: { trace: { mode: 'on' } } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@@ -720,7 +720,7 @@ test('should expand expect.toPass', async ({ runInlineTest }, testInfo) => {
test('should show non-expect error in trace', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { trace: { mode: 'on' } } };
+ export default { use: { trace: { mode: 'on' } } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@@ -758,7 +758,7 @@ test('should show non-expect error in trace', async ({ runInlineTest }, testInfo
test('should show error from beforeAll in trace', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { trace: { mode: 'on' } } };
+ export default { use: { trace: { mode: 'on' } } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@@ -798,7 +798,7 @@ test('should throw when trace fixture is a function', async ({ runInlineTest },
test('should not throw when attachment is missing', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { trace: 'on' } };
+ export default { use: { trace: 'on' } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@@ -823,7 +823,7 @@ test('should not throw when screenshot on failure fails', async ({ runInlineTest
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { trace: 'on', screenshot: 'on' } };
+ export default { use: { trace: 'on', screenshot: 'on' } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@@ -849,7 +849,7 @@ test('should not throw when screenshot on failure fails', async ({ runInlineTest
test('should use custom expect message in trace', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { trace: { mode: 'on' } } };
+ export default { use: { trace: { mode: 'on' } } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@@ -886,7 +886,7 @@ test('should not throw when merging traces multiple times', async ({ runInlineTe
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { trace: 'on' } };
+ export default { use: { trace: 'on' } };
`,
'a.spec.ts': `
import { BrowserContext, expect, Page, test as baseTest } from '@playwright/test';
@@ -930,7 +930,7 @@ test('should not throw when merging traces multiple times', async ({ runInlineTe
test('should record nested steps, even after timeout', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: { trace: { mode: 'on' } },
timeout: 5000,
};
@@ -1086,7 +1086,7 @@ test('should record nested steps, even after timeout', async ({ runInlineTest },
test('should not produce an action entry for calling a binding', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { trace: 'on' } };
+ export default { use: { trace: 'on' } };
`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@@ -1128,7 +1128,7 @@ test('should not produce an action entry for calling a binding', async ({ runInl
test('should attribute worker fixture teardown to the right test', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: { trace: { mode: 'on' } },
};
`,
diff --git a/tests/playwright-test/reporter-base.spec.ts b/tests/playwright-test/reporter-base.spec.ts
index aa7fdef8e3..70e89981a5 100644
--- a/tests/playwright-test/reporter-base.spec.ts
+++ b/tests/playwright-test/reporter-base.spec.ts
@@ -193,7 +193,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('should print slow tests', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'foo' },
{ name: 'bar' },
@@ -232,7 +232,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('should print if maxFailures is reached', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
maxFailures: 1,
};
`,
@@ -260,7 +260,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/29768' });
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
globalTimeout: 3000,
};
`,
@@ -286,7 +286,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('should not print slow parallel tests', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
reportSlowTests: { max: 0, threshold: 500 },
};
`,
@@ -310,7 +310,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('should not print slow tests', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'baz' },
{ name: 'qux' },
@@ -490,7 +490,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('should omit tags when omitTags is set', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['list', { omitTags: true }]],
};
`,
@@ -522,7 +522,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('should omit tags from failures when omitTags is set', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['list', { omitTags: true }]],
};
`,
@@ -544,7 +544,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('should omit tags via the PLAYWRIGHT_LIST_OMIT_TAGS environment variable', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['list']],
};
`,
@@ -571,7 +571,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('should let PLAYWRIGHT_LIST_OMIT_TAGS override the omitTags option', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['list', { omitTags: true }]],
};
`,
diff --git a/tests/playwright-test/reporter-blob.spec.ts b/tests/playwright-test/reporter-blob.spec.ts
index cd3ba802f7..10b97833a3 100644
--- a/tests/playwright-test/reporter-blob.spec.ts
+++ b/tests/playwright-test/reporter-blob.spec.ts
@@ -91,7 +91,7 @@ test('should call methods in right order', async ({ runInlineTest, mergeReports
const files = {
'echo-reporter.js': echoReporterJs,
'playwright.config.ts': `
- module.exports = {
+ export default {
retries: 1,
reporter: [['blob', { outputDir: '${reportDir.replace(/\\/g, '/')}' }]]
};
@@ -162,7 +162,7 @@ test('should fail merge and report error when reporter throws in onEnd', async (
module.exports = ThrowingReporter;
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['blob', { outputDir: '${reportDir.replace(/\\/g, '/')}' }]]
};
`,
@@ -187,7 +187,7 @@ test('should merge into html with dependencies', async ({ runInlineTest, mergeRe
const reportDir = test.info().outputPath('blob-report');
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
retries: 1,
reporter: [['blob', { outputDir: '${reportDir.replace(/\\/g, '/')}' }]],
projects: [
@@ -273,7 +273,7 @@ test('should merge blob into blob', async ({ runInlineTest, mergeReports, showRe
const reportDir = test.info().outputPath('blob-report-orig');
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
retries: 1,
reporter: [['blob', { outputDir: '${reportDir.replace(/\\/g, '/')}' }]]
};
@@ -330,7 +330,7 @@ test('should produce consistent step ids', {
}, async ({ runInlineTest, mergeReports, showReport, page }) => {
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
retries: 1,
reporter: [
['blob', { outputFile: 'blob-report/report-1.zip' }],
@@ -361,7 +361,7 @@ test('be able to merge incomplete shards', async ({ runInlineTest, mergeReports,
const reportDir = test.info().outputPath('blob-report');
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
retries: 1,
reporter: [['blob', { outputDir: '${reportDir.replace(/\\/g, '/')}' }]]
};
@@ -416,7 +416,7 @@ test('total time is from test run not from merge', async ({ runInlineTest, merge
const reportDir = test.info().outputPath('blob-report');
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
retries: 1,
reporter: [['blob', { outputDir: '${reportDir.replace(/\\/g, '/')}' }]]
};
@@ -460,7 +460,7 @@ test('merge into list report by default', async ({ runInlineTest, mergeReports }
const reportDir = test.info().outputPath('blob-report');
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
retries: 1,
reporter: [['blob', { outputDir: '${reportDir.replace(/\\/g, '/')}' }]]
};
@@ -548,7 +548,7 @@ test('should print progress', async ({ runInlineTest, mergeReports }) => {
const reportDir = test.info().outputPath('blob-report');
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
retries: 1,
reporter: [['blob', { outputDir: '${reportDir.replace(/\\/g, '/')}' }]]
};
@@ -607,7 +607,7 @@ test('preserve attachments', async ({ runInlineTest, mergeReports, showReport, p
const reportDir = test.info().outputPath('blob-report');
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
retries: 1,
reporter: [['blob', { outputDir: '${reportDir.replace(/\\/g, '/')}' }]]
};
@@ -667,7 +667,7 @@ test('generate html with attachment urls', async ({ runInlineTest, mergeReports,
const reportDir = test.info().outputPath('blob-report');
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
retries: 1,
use: {
trace: 'on'
@@ -751,7 +751,7 @@ test('resource names should not clash between runs', async ({ runInlineTest, sho
const reportDir = test.info().outputPath('blob-report');
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['blob', { outputDir: '${reportDir.replace(/\\/g, '/')}' }]]
};
`,
@@ -820,7 +820,7 @@ test('multiple output reports', async ({ runInlineTest, mergeReports, showReport
const reportDir = test.info().outputPath('blob-report');
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
retries: 1,
reporter: [['blob', { outputDir: '${reportDir.replace(/\\/g, '/')}' }]]
};
@@ -875,12 +875,12 @@ test('multiple output reports based on config', async ({ runInlineTest, mergeRep
const reportDir = test.info().outputPath('blob-report');
const files = {
'merged/playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['blob', { outputDir: 'merged-blob' }], ['html', { outputFolder: 'html', open: 'never' }], ['line']]
};
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
retries: 1,
reporter: [['blob', { outputDir: '${reportDir.replace(/\\/g, '/')}' }]]
};
@@ -942,7 +942,7 @@ test('onError in the report', async ({ runInlineTest, mergeReports, showReport,
const reportDir = test.info().outputPath('blob-report');
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
retries: 1,
tag: process.env.GLOBAL_TAG,
reporter: [['blob', { outputDir: '${reportDir.replace(/\\/g, '/')}' }]]
@@ -1033,7 +1033,7 @@ test('preserve config fields', async ({ runInlineTest, mergeReports }) => {
module.exports = EchoReporter;
`,
'playwright.config.ts': `
- module.exports = ${JSON.stringify(config, null, 2)};
+ export default ${JSON.stringify(config, null, 2)};
`,
'a.test.js': `
import { test, expect } from '@playwright/test';
@@ -1207,7 +1207,7 @@ test('preserve steps in html report', async ({ runInlineTest, mergeReports, show
const reportDir = test.info().outputPath('blob-report');
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['blob']]
};
`,
@@ -1269,7 +1269,7 @@ test('preserve step params', async ({ runInlineTest, mergeReports }) => {
module.exports = ParamsReporter;
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['blob']]
};
`,
@@ -1293,7 +1293,7 @@ test('preserve step params', async ({ runInlineTest, mergeReports }) => {
test('support fileName option', async ({ runInlineTest, mergeReports }) => {
const files = (fileSuffix: string) => ({
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['blob', { fileName: 'report-${fileSuffix}.zip' }]],
projects: [
{ name: 'foo' },
@@ -1318,7 +1318,7 @@ test('support PLAYWRIGHT_BLOB_OUTPUT_DIR env variable', async ({ runInlineTest,
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/30091' });
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['blob']],
projects: [
{ name: 'foo' },
@@ -1342,7 +1342,7 @@ test('support PLAYWRIGHT_BLOB_OUTPUT_NAME env variable', async ({ runInlineTest,
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/30091' });
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['blob']],
projects: [
{ name: 'foo' },
@@ -1367,7 +1367,7 @@ test('support outputFile option', async ({ runInlineTest, mergeReports }) => {
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/30091' });
const files = (fileSuffix: string) => ({
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['blob', { outputDir: 'should-be-ignored', outputFile: 'my-reports/report-${fileSuffix}.zip' }]],
projects: [
{ name: 'foo' },
@@ -1392,7 +1392,7 @@ test('support PLAYWRIGHT_BLOB_OUTPUT_FILE environment variable', async ({ runInl
test.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/30091' });
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: 'blob',
projects: [
{ name: 'foo' },
@@ -1425,7 +1425,7 @@ test('support PLAYWRIGHT_BLOB_OUTPUT_FILE environment variable', async ({ runInl
test('keep projects with same name different global tag separate', async ({ runInlineTest, mergeReports, showReport, page }) => {
const files = (reportName: string) => ({
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['blob']],
tag: process.env.GLOBAL_TAG,
projects: [
@@ -1493,7 +1493,7 @@ test('blob report should include version', async ({ runInlineTest }) => {
const reportDir = test.info().outputPath('blob-report');
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['blob']]
};
`,
@@ -1541,7 +1541,7 @@ test('merge-reports should throw if report version is from the future', async ({
const reportDir = test.info().outputPath('blob-report');
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['blob']]
};
`,
@@ -1583,7 +1583,7 @@ test('merge-reports should merge old attachments (pre-1.53)', async ({ runInline
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['blob']]
};
`,
@@ -1591,7 +1591,7 @@ test('merge-reports should merge old attachments (pre-1.53)', async ({ runInline
import { test, expect } from '@playwright/test';
test('test 1', async ({}) => {});
`,
- 'merge.config.ts': `module.exports = {
+ 'merge.config.ts': `export default {
testDir: 'mergeRoot',
};`,
};
@@ -1614,7 +1614,7 @@ test('merge-reports should merge old attachments (pre-1.53)', async ({ runInline
test('should merge blob reports with same name', async ({ runInlineTest, mergeReports, showReport, page }) => {
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
retries: 1,
reporter: 'blob'
};
@@ -1672,7 +1672,7 @@ test('reporter list in the custom config', async ({ runInlineTest, mergeReports
const reportDir = test.info().outputPath('blob-report');
const files = {
'playwright.config.ts': `
- module.exports = { reporter: 'blob' };
+ export default { reporter: 'blob' };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -1690,7 +1690,7 @@ test('reporter list in the custom config', async ({ runInlineTest, mergeReports
module.exports = TestReporter;
`,
'merged/playwright.config.ts': `
- module.exports = {
+ export default {
retries: 1,
reporter: [['./testReporter.js', { myOpt: 1 }]]
};
@@ -1719,11 +1719,11 @@ test('merge reports with different rootDirs', async ({ runInlineTest, mergeRepor
}
};
`,
- 'merge.config.ts': `module.exports = {
+ 'merge.config.ts': `export default {
testDir: 'mergeRoot',
reporter: './echo-reporter.js'
};`,
- 'dir1/playwright.config.ts': `module.exports = {
+ 'dir1/playwright.config.ts': `export default {
testDir: 'tests1',
reporter: [['blob', { outputDir: 'blob-report' }]]
};`,
@@ -1735,7 +1735,7 @@ test('merge reports with different rootDirs', async ({ runInlineTest, mergeRepor
await runInlineTest(files1, { workers: 1 }, undefined, { additionalArgs: ['--config', test.info().outputPath('dir1/playwright.config.ts')] });
const files2 = {
- 'dir2/playwright.config.ts': `module.exports = {
+ 'dir2/playwright.config.ts': `export default {
reporter: [['blob', { outputDir: 'blob-report' }]]
};`,
'dir2/tests2/b.test.js': `
@@ -1777,7 +1777,7 @@ test('merge reports same rootDirs', async ({ runInlineTest, mergeReports }) => {
}
};
`,
- 'playwright.config.ts': `module.exports = {
+ 'playwright.config.ts': `export default {
testDir: 'tests',
reporter: [['blob', { outputDir: 'blob-report' }]]
};`,
@@ -1836,11 +1836,11 @@ test('merge reports with different rootDirs and path separators', async ({ runIn
}
};
`,
- 'merge.config.ts': `module.exports = {
+ 'merge.config.ts': `export default {
testDir: 'mergeRoot',
reporter: './echo-reporter.js'
};`,
- 'dir1/playwright.config.ts': `module.exports = {
+ 'dir1/playwright.config.ts': `export default {
reporter: [['blob', { outputDir: 'blob-report' }]]
};`,
'dir1/tests1/a.test.js': `
@@ -1851,7 +1851,7 @@ test('merge reports with different rootDirs and path separators', async ({ runIn
await runInlineTest(files1, { workers: 1 }, undefined, { additionalArgs: ['--config', test.info().outputPath('dir1/playwright.config.ts')] });
const files2 = {
- 'dir2/playwright.config.ts': `module.exports = {
+ 'dir2/playwright.config.ts': `export default {
reporter: [['blob', { outputDir: 'blob-report' }]]
};`,
'dir2/tests2/b.test.js': `
@@ -1908,7 +1908,7 @@ test('merge reports without --config preserves path separators', async ({ runInl
}
};
`,
- 'dir1/playwright.config.ts': `module.exports = {
+ 'dir1/playwright.config.ts': `export default {
reporter: [['blob', { outputDir: 'blob-report' }]]
};`,
'dir1/tests1/a.test.js': `
@@ -1952,7 +1952,7 @@ test('merge reports should preserve attachments', async ({ runInlineTest, mergeR
const reportDir = test.info().outputPath('blob-report-orig');
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
retries: 1,
reporter: [['blob', { outputDir: '${reportDir.replace(/\\/g, '/')}' }]]
};
@@ -2043,12 +2043,12 @@ test('merge reports must not change test ids when there is no need to', async ({
}
};
`,
- 'single-run.config.ts': `module.exports = {
+ 'single-run.config.ts': `export default {
reporter: [
['./echo-test-id-reporter.js'],
]
};`,
- 'shard-1.config.ts': `module.exports = {
+ 'shard-1.config.ts': `export default {
fullyParallel: true,
shard: { total: 2, current: 1 },
reporter: [
@@ -2056,7 +2056,7 @@ test('merge reports must not change test ids when there is no need to', async ({
['blob', { outputDir: 'blob-report' }],
]
};`,
- 'shard-2.config.ts': `module.exports = {
+ 'shard-2.config.ts': `export default {
fullyParallel: true,
shard: { total: 2, current: 2 },
reporter: [
@@ -2064,7 +2064,7 @@ test('merge reports must not change test ids when there is no need to', async ({
['blob', { outputDir: 'blob-report' }],
]
};`,
- 'merge.config.ts': `module.exports = {
+ 'merge.config.ts': `export default {
reporter: [
['./echo-test-id-reporter.js'],
]
@@ -2115,11 +2115,11 @@ test('TestSuite.project() should return owning project', async ({ runInlineTest,
}
};
`,
- 'merge.config.ts': `module.exports = {
+ 'merge.config.ts': `export default {
testDir: 'mergeRoot',
reporter: './echo-reporter.js'
};`,
- 'playwright.config.ts': `module.exports = {
+ 'playwright.config.ts': `export default {
testDir: 'tests',
reporter: [['blob', { outputDir: 'blob-report' }]],
projects: [{name: 'my-project'}]
@@ -2150,7 +2150,7 @@ test('open blob-1.42', async ({ runInlineTest, mergeReports }) => {
}
};
`,
- 'merge.config.ts': `module.exports = {
+ 'merge.config.ts': `export default {
testDir: 'mergeRoot',
reporter: './echo-reporter.js'
};`,
@@ -2190,7 +2190,7 @@ test('preserve static annotations when tests did not run', async ({ runInlineTes
const reportDir = test.info().outputPath('blob-report');
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: 'blob',
projects: [
{ name: 'setup', testMatch: 'setup.js' },
@@ -2235,7 +2235,7 @@ test('preserve static annotations when tests did not run', async ({ runInlineTes
test('project filter in report name', async ({ runInlineTest }) => {
const files = {
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: 'blob',
projects: [
{ name: 'foo' },
@@ -2291,7 +2291,7 @@ test('should report duration across all shards', async ({ runInlineTest, mergeRe
}
const files = {
'playwright.config.ts': `
- module.exports = ${JSON.stringify(config, null, 2)};
+ export default ${JSON.stringify(config, null, 2)};
`,
'a.test.js': `
import { test, expect } from '@playwright/test';
@@ -2323,7 +2323,7 @@ test('shard chart', async ({ runInlineTest, writeFiles, showReport, page, mergeR
const reportDir = test.info().outputPath('blob-reports');
await writeFiles({
'playwright.config.ts': `
- module.exports = {
+ export default {
fullyParallel: true,
tag: process.env.BOT_TAG,
reporter: [['blob', { outputDir: '${reportDir.replace(/\\/g, '/')}' }]]
@@ -2380,7 +2380,7 @@ test('should populate projects in config when merging reports', async ({ runInli
const files = {
'reporter.js': `module.exports = ${CustomReporter.toString()};`,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['blob', { outputDir: '${reportDir.replace(/\\/g, '/')}' }]],
projects: [
{ name: 'setup' },
@@ -2412,7 +2412,7 @@ test('workerIndex is rebased', async ({ runInlineTest, writeFiles, showReport, p
const reportDir = test.info().outputPath('blob-reports');
await writeFiles({
'playwright.config.ts': `
- module.exports = {
+ export default {
fullyParallel: true,
reporter: [['blob', { outputDir: '${reportDir.replace(/\\/g, '/')}' }]]
};
diff --git a/tests/playwright-test/reporter-dot.spec.ts b/tests/playwright-test/reporter-dot.spec.ts
index 04a9337ec0..b2265579e6 100644
--- a/tests/playwright-test/reporter-dot.spec.ts
+++ b/tests/playwright-test/reporter-dot.spec.ts
@@ -82,7 +82,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('should work from config', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { reporter: 'dot' };
+ export default { reporter: 'dot' };
`,
'a.test.js': `
import { test, expect } from '@playwright/test';
diff --git a/tests/playwright-test/reporter-github.spec.ts b/tests/playwright-test/reporter-github.spec.ts
index 6c57c1c34f..6ace7068a1 100644
--- a/tests/playwright-test/reporter-github.spec.ts
+++ b/tests/playwright-test/reporter-github.spec.ts
@@ -62,7 +62,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('print GitHub annotations for slow tests', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
reportSlowTests: { max: 0, threshold: 100 }
};
`,
diff --git a/tests/playwright-test/reporter-html.spec.ts b/tests/playwright-test/reporter-html.spec.ts
index 85f79c83c4..7bb6dbeab9 100644
--- a/tests/playwright-test/reporter-html.spec.ts
+++ b/tests/playwright-test/reporter-html.spec.ts
@@ -59,7 +59,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
test('should generate report', async ({ runInlineTest, showReport, page }) => {
await runInlineTest({
'playwright.config.ts': `
- module.exports = { name: 'project-name' };
+ export default { name: 'project-name' };
`,
'a.test.js': `
import { test, expect } from '@playwright/test';
@@ -151,7 +151,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
const invalidOption = 'invalid-option';
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { preserveOutput: 'failures-only' };
+ export default { preserveOutput: 'failures-only' };
`,
'a.test.js': `
import { test, expect } from '@playwright/test';
@@ -167,7 +167,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
test('should not throw when attachment is missing', async ({ runInlineTest, page, showReport }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { preserveOutput: 'failures-only' };
+ export default { preserveOutput: 'failures-only' };
`,
'a.test.js': `
import { test, expect } from '@playwright/test';
@@ -190,7 +190,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
const expected = Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAAhVJREFUeJzt07ERwCAQwLCQ/Xd+FuDcQiFN4MZrZuYDjv7bAfAyg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAiEDVPZBYx6ffy+AAAAAElFTkSuQmCC', 'base64');
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { viewport: { width: 200, height: 200 }} };
+ export default { use: { viewport: { width: 200, height: 200 }} };
`,
'a.test.js-snapshots/expected-linux.png': expected,
'a.test.js-snapshots/expected-darwin.png': expected,
@@ -264,7 +264,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
snapshotPathTemplate: '__screenshots__/{testFilePath}/{arg}{ext}',
use: { viewport: { width: ${IMG_WIDTH}, height: ${IMG_HEIGHT} }}
};
@@ -301,7 +301,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
const expected = Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAAhVJREFUeJzt07ERwCAQwLCQ/Xd+FuDcQiFN4MZrZuYDjv7bAfAyg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAiEDVPZBYx6ffy+AAAAAElFTkSuQmCC', 'base64');
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { viewport: { width: 200, height: 200 }} };
+ export default { use: { viewport: { width: 200, height: 200 }} };
`,
'a.test.js-snapshots/expected-linux.png': expected,
'a.test.js-snapshots/expected-darwin.png': expected,
@@ -338,7 +338,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
const expected = Buffer.from('iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAAAXNSR0IArs4c6QAAAhVJREFUeJzt07ERwCAQwLCQ/Xd+FuDcQiFN4MZrZuYDjv7bAfAyg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAgEg0AwCASDQDAIBINAMAiEDVPZBYx6ffy+AAAAAElFTkSuQmCC', 'base64');
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { use: { viewport: { width: 200, height: 200 }} };
+ export default { use: { viewport: { width: 200, height: 200 }} };
`,
'a.test.js-snapshots/expected-linux': expected,
'a.test.js-snapshots/expected-darwin': expected,
@@ -366,7 +366,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
test('should include screenshot on failure', async ({ runInlineTest, page, showReport }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: {
viewport: { width: 200, height: 200 },
screenshot: 'only-on-failure',
@@ -395,7 +395,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
test('should use different path if attachments base url option is provided', async ({ runInlineTest, page, showReport }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: {
viewport: { width: 200, height: 200 },
screenshot: 'on',
@@ -431,7 +431,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
test('should display report title if provided', async ({ runInlineTest, page, showReport }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['html', { title: 'Custom report title' }], ['line']]
};
`,
@@ -452,7 +452,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
test('should process URLs as links in report title', async ({ runInlineTest, page, showReport }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['html', { title: 'Custom report title https://playwright.dev separator http://microsoft.com end' }], ['line']]
};
`,
@@ -479,7 +479,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
globalTeardown: './global-teardown.js',
};
`,
@@ -1751,7 +1751,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
test.skip(useIntermediateMergeReport);
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['html', { outputFolder: 'test-results/html-report' }]]
}
`,
@@ -1771,7 +1771,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
test.skip(useIntermediateMergeReport);
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['html', { outputFolder: 'test-results-html' }]]
}
`,
@@ -1791,7 +1791,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
test.skip(useIntermediateMergeReport);
const result = await runInlineTest({
'nested/project/playwright.config.ts': `
- module.exports = { reporter: [['html', { outputFolder: '../my-report/' }]] };
+ export default { reporter: [['html', { outputFolder: '../my-report/' }]] };
`,
'nested/project/a.test.js': `
import { test, expect } from '@playwright/test';
@@ -3221,7 +3221,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
test('should print a user-friendly warning when opening a trace via file:// protocol', async ({ runInlineTest, showReport, page }) => {
await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [{
name: 'chromium',
use: {
@@ -3561,7 +3561,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
test('should support keyboard shortcuts', async ({ runInlineTest, showReport, page }) => {
await runInlineTest({
'playwright.config.ts': `
- module.exports = { name: 'project-name' };
+ export default { name: 'project-name' };
`,
'a.test.js': `
import { test, expect } from '@playwright/test';
@@ -3648,7 +3648,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
test('clicking on label should not exit speedboard', async ({ runInlineTest, showReport, page }) => {
await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [{ name: 'foo' }, { name: 'bar' }],
};
`,
@@ -3711,7 +3711,7 @@ for (const useIntermediateMergeReport of [true, false] as const) {
test('next/prev buttons should follow speed', async ({ runInlineTest, showReport, page }) => {
await runInlineTest({
'playwright.config.ts': `
- module.exports = {};
+ export default {};
`,
'a.test.js': `
import { test, expect } from '@playwright/test';
diff --git a/tests/playwright-test/reporter-json.spec.ts b/tests/playwright-test/reporter-json.spec.ts
index 1fc639bc33..fa86731db3 100644
--- a/tests/playwright-test/reporter-json.spec.ts
+++ b/tests/playwright-test/reporter-json.spec.ts
@@ -73,7 +73,7 @@ test('should not report skipped due to sharding', async ({ runInlineTest }) => {
test('should report projects and stats', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
retries: 2,
projects: [
{
@@ -122,7 +122,7 @@ test('should report projects and stats', async ({ runInlineTest }, testInfo) =>
test('should merge specs from all projects when testDir is not cwd', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
testDir: 'tests',
projects: [{ name: 'p1' }, { name: 'p2' }],
};
@@ -236,7 +236,7 @@ test('should have error position in results', async ({
test('should add dot in addition to file json with CI', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { reporter: [['json', { outputFile: 'a.json' }]] };
+ export default { reporter: [['json', { outputFile: 'a.json' }]] };
`,
'a.test.js': `
import { test, expect } from '@playwright/test';
@@ -253,7 +253,7 @@ test('should add dot in addition to file json with CI', async ({ runInlineTest }
test('should add line in addition to file json without CI', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { reporter: [['json', { outputFile: 'a.json' }]] };
+ export default { reporter: [['json', { outputFile: 'a.json' }]] };
`,
'a.test.js': `
const { test, expect } = require('@playwright/test');
@@ -284,7 +284,7 @@ test.describe('report location', () => {
test('with config should create report relative to config', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'nested/project/playwright.config.ts': `
- module.exports = { reporter: [['json', { outputFile: '../my-report/a.json' }]] };
+ export default { reporter: [['json', { outputFile: '../my-report/a.json' }]] };
`,
'nested/project/a.test.js': `
import { test, expect } from '@playwright/test';
diff --git a/tests/playwright-test/reporter-junit.spec.ts b/tests/playwright-test/reporter-junit.spec.ts
index ed8f1fe579..15404823fb 100644
--- a/tests/playwright-test/reporter-junit.spec.ts
+++ b/tests/playwright-test/reporter-junit.spec.ts
@@ -169,7 +169,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('should render stdout without ansi escapes', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [ ['junit', { stripANSIControlSequences: true }] ],
};
`,
@@ -191,7 +191,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('should render, by default, character data as CDATA sections', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [ ['junit'] ],
};
`,
@@ -262,7 +262,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('should not render projects if they dont exist', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { };
+ export default { };
`,
'a.test.js': `
import { test, expect } from '@playwright/test';
@@ -288,7 +288,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('should render projects', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [ { name: 'project1' }, { name: 'project2' } ] };
+ export default { projects: [ { name: 'project1' }, { name: 'project2' } ] };
`,
'a.test.js': `
import { test, expect } from '@playwright/test';
@@ -323,7 +323,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('should includeProjectInTestName', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [ { name: 'project1' }, { name: 'project2' } ],
reporter: [['junit', { includeProjectInTestName: true }]]
};
@@ -378,7 +378,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test.skip(useIntermediateMergeReport, 'Blob report hashes attachment paths');
const result = await runInlineTest({
'project/playwright.config.ts': `
- module.exports = { reporter: [['junit', { outputFile: '../my-report/junit/a.xml' }]] };
+ export default { reporter: [['junit', { outputFile: '../my-report/junit/a.xml' }]] };
`,
'project/a.test.js': `
import { test, expect } from '@playwright/test';
@@ -414,7 +414,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('should render annotations to custom testcase properties', async ({ runInlineTest }) => {
const result = await runInlineTest({
- 'playwright.config.ts': `module.exports = { reporter: 'junit' };`,
+ 'playwright.config.ts': `export default { reporter: 'junit' };`,
'a.test.js': `
import { test, expect } from '@playwright/test';
test('one', async ({}, testInfo) => {
@@ -433,7 +433,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('should render built-in annotations to testcase properties', async ({ runInlineTest }) => {
const result = await runInlineTest({
- 'playwright.config.ts': `module.exports = { reporter: 'junit' };`,
+ 'playwright.config.ts': `export default { reporter: 'junit' };`,
'a.test.js': `
import { test, expect } from '@playwright/test';
test('one', async ({}, testInfo) => {
@@ -456,7 +456,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
const xrayOptions = {
embedAnnotationsAsProperties: true
}
- module.exports = {
+ export default {
reporter: [ ['junit', xrayOptions] ],
};
`,
@@ -511,7 +511,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test.skip(useIntermediateMergeReport);
const result = await runInlineTest({
'nested/project/playwright.config.ts': `
- module.exports = { reporter: [['junit', { outputFile: '../my-report/a.xml' }]] };
+ export default { reporter: [['junit', { outputFile: '../my-report/a.xml' }]] };
`,
'nested/project/a.test.js': `
import { test, expect } from '@playwright/test';
@@ -637,7 +637,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('should emit flakyFailure for flaky tests when includeRetries is enabled', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
retries: 2,
reporter: [['junit', { includeRetries: true }]]
};
@@ -688,7 +688,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('should emit rerunFailure for permanent failures when includeRetries is enabled', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
retries: 1,
reporter: [['junit', { includeRetries: true }]]
};
diff --git a/tests/playwright-test/reporter-list.spec.ts b/tests/playwright-test/reporter-list.spec.ts
index d3b22c332f..1f76920ad1 100644
--- a/tests/playwright-test/reporter-list.spec.ts
+++ b/tests/playwright-test/reporter-list.spec.ts
@@ -27,7 +27,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('render each test with project name', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'foo' },
{ name: 'bar' },
] };
@@ -198,7 +198,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('should truncate long test names', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'foo' },
] };
`,
@@ -262,7 +262,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('print failures inline with option', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['list', { printFailuresInline: true }]],
workers: 1,
};
@@ -293,7 +293,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
// still print the failure inline, even though the retry budget is not exhausted.
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['list', { printFailuresInline: true }]],
retries: 1,
workers: 1,
@@ -319,7 +319,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('print failures inline with retries', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['list', { printFailuresInline: true }]],
retries: 2,
workers: 1,
@@ -350,7 +350,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
test('print failures inline for a flaky test', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['list', { printFailuresInline: true }]],
retries: 1,
workers: 1,
diff --git a/tests/playwright-test/reporter-onend.spec.ts b/tests/playwright-test/reporter-onend.spec.ts
index 9442318809..530dff8103 100644
--- a/tests/playwright-test/reporter-onend.spec.ts
+++ b/tests/playwright-test/reporter-onend.spec.ts
@@ -28,7 +28,7 @@ module.exports = Reporter;
test('should override exit code', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': reporter,
- 'playwright.config.ts': `module.exports = { reporter: './reporter' };`,
+ 'playwright.config.ts': `export default { reporter: './reporter' };`,
'a.test.js': `
import { test, expect } from '@playwright/test';
test('fail', async ({}) => {
@@ -48,7 +48,7 @@ test('should fail run and report error when reporter throws in onEnd', async ({
}
}
`,
- 'playwright.config.ts': `module.exports = { reporter: [['dot'], ['./reporter.ts']] };`,
+ 'playwright.config.ts': `export default { reporter: [['dot'], ['./reporter.ts']] };`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('passing', async () => {});
@@ -68,7 +68,7 @@ test('should fail run and report error when reporter throws in onTestEnd', async
}
}
`,
- 'playwright.config.ts': `module.exports = { reporter: [['dot'], ['./reporter.ts']] };`,
+ 'playwright.config.ts': `export default { reporter: [['dot'], ['./reporter.ts']] };`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('passing', async () => {});
diff --git a/tests/playwright-test/reporter-perfetto.spec.ts b/tests/playwright-test/reporter-perfetto.spec.ts
index eaedea02bd..9c887ef8a4 100644
--- a/tests/playwright-test/reporter-perfetto.spec.ts
+++ b/tests/playwright-test/reporter-perfetto.spec.ts
@@ -222,7 +222,7 @@ for (const fileName of ['trace.json', 'trace.json.gz']) {
await fs.promises.mkdir(outputFile);
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { reporter: [['perfetto', { outputFile: ${JSON.stringify(outputFile)} }]] };
+ export default { reporter: [['perfetto', { outputFile: ${JSON.stringify(outputFile)} }]] };
`,
'a.test.ts': `
import { test } from '@playwright/test';
@@ -238,7 +238,7 @@ for (const fileName of ['trace.json', 'trace.json.gz']) {
test('should respect outputFile option', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { reporter: [['perfetto', { outputFile: 'reports/my-trace.json' }]] };
+ export default { reporter: [['perfetto', { outputFile: 'reports/my-trace.json' }]] };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -252,7 +252,7 @@ test('should respect outputFile option', async ({ runInlineTest }, testInfo) =>
test('should gzip the report when output file ends with .gz', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { reporter: [['perfetto', { outputFile: 'perfetto.json.gz' }]] };
+ export default { reporter: [['perfetto', { outputFile: 'perfetto.json.gz' }]] };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
diff --git a/tests/playwright-test/reporter-preprocess.spec.ts b/tests/playwright-test/reporter-preprocess.spec.ts
index 6ff4e2c790..e8c411c78b 100644
--- a/tests/playwright-test/reporter-preprocess.spec.ts
+++ b/tests/playwright-test/reporter-preprocess.spec.ts
@@ -35,9 +35,9 @@ test('preprocess sees the filtered corpus, can skip tests, and records the calle
console.log('%% end ' + test.title + ' status=' + result.status + ' expected=' + test.expectedStatus + ' ann=' + test.annotations.map(a => a.type + ':' + (a.description || '')).join(',') + ' loc=' + loc);
}
}
- module.exports = Reporter;
+ export default Reporter;
`,
- 'playwright.config.ts': `module.exports = { reporter: './reporter.ts' };`,
+ 'playwright.config.ts': `export default { reporter: './reporter.ts' };`,
'a.test.ts': `
import { test } from '@playwright/test';
test('ignored-by-only', async () => {});
@@ -63,9 +63,9 @@ test('preprocess sees the filtered corpus, can skip tests, and records the calle
console.log('%% plan: ' + suite.allTests().map(t => t.title).join(','));
}
}
- module.exports = Reporter;
+ export default Reporter;
`,
- 'playwright.config.ts': `module.exports = { reporter: './reporter.ts' };`,
+ 'playwright.config.ts': `export default { reporter: './reporter.ts' };`,
'a.test.ts': `
import { test } from '@playwright/test';
test('foo-one', async () => {});
@@ -83,10 +83,10 @@ test('preprocess sees the filtered corpus, can skip tests, and records the calle
console.log('%% plan projects: ' + suite.suites.map(s => s.title).join(','));
}
}
- module.exports = Reporter;
+ export default Reporter;
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter.ts',
projects: [{ name: 'one' }, { name: 'two' }],
};
@@ -120,9 +120,9 @@ test('TestCase.exclude and Suite.exclude remove entries from the run and report'
console.log('%% ran ' + test.title);
}
}
- module.exports = Reporter;
+ export default Reporter;
`,
- 'playwright.config.ts': `module.exports = { reporter: './reporter.ts' };`,
+ 'playwright.config.ts': `export default { reporter: './reporter.ts' };`,
'a.test.ts': `
import { test } from '@playwright/test';
test('kept', async () => {});
@@ -155,9 +155,9 @@ test('Suite.skip cascades to all descendants', async ({ runInlineTest }) => {
console.log('%% ' + test.title + ':' + result.status + ':' + test.expectedStatus);
}
}
- module.exports = Reporter;
+ export default Reporter;
`,
- 'playwright.config.ts': `module.exports = { reporter: './reporter.ts' };`,
+ 'playwright.config.ts': `export default { reporter: './reporter.ts' };`,
'a.test.ts': `
import { test } from '@playwright/test';
test.describe('doomed', () => {
@@ -205,9 +205,9 @@ test('TestRun methods throw outside preprocess, and the root suite cannot be exc
}
}
}
- module.exports = Reporter;
+ export default Reporter;
`,
- 'playwright.config.ts': `module.exports = { reporter: './reporter.ts' };`,
+ 'playwright.config.ts': `export default { reporter: './reporter.ts' };`,
'a.test.ts': `
import { test } from '@playwright/test';
test('t', async () => {});
@@ -242,9 +242,9 @@ test('preprocess throwing aborts the run before onBegin', async ({ runInlineTest
console.log('%% error: ' + err.message);
}
}
- module.exports = Reporter;
+ export default Reporter;
`,
- 'playwright.config.ts': `module.exports = { reporter: './reporter.ts' };`,
+ 'playwright.config.ts': `export default { reporter: './reporter.ts' };`,
'a.test.ts': `
import { test } from '@playwright/test';
test('one', async () => {});
@@ -272,7 +272,7 @@ test('multiple reporters: preprocess called in order, annotations accumulate, ex
console.log('%% first onTestEnd: ' + test.expectedStatus + ' ann=' + test.annotations.map(a => a.type).join(','));
}
}
- module.exports = R;
+ export default R;
`,
'second.ts': `
class R {
@@ -281,9 +281,9 @@ test('multiple reporters: preprocess called in order, annotations accumulate, ex
testRun.skip(suite.allTests()[0], 'second reason');
}
}
- module.exports = R;
+ export default R;
`,
- 'playwright.config.ts': `module.exports = { reporter: [['./first.ts'], ['./second.ts']] };`,
+ 'playwright.config.ts': `export default { reporter: [['./first.ts'], ['./second.ts']] };`,
'a.test.ts': `
import { test } from '@playwright/test';
test('kept', async () => {});
@@ -308,7 +308,7 @@ test('multiple reporters: a later reporter observes an earlier reporter Suite.sk
testRun.skip(suite.allTests()[0].parent, 'first reason');
}
}
- module.exports = R;
+ export default R;
`,
'second.ts': `
class R {
@@ -317,9 +317,9 @@ test('multiple reporters: a later reporter observes an earlier reporter Suite.sk
console.log('%% second sees skipped: ' + skipped.join(','));
}
}
- module.exports = R;
+ export default R;
`,
- 'playwright.config.ts': `module.exports = { reporter: [['./first.ts'], ['./second.ts']] };`,
+ 'playwright.config.ts': `export default { reporter: [['./first.ts'], ['./second.ts']] };`,
'a.test.ts': `
import { test } from '@playwright/test';
test.describe('group', () => {
@@ -351,9 +351,9 @@ test('skipSharding disables the built-in shard filter; preprocess sees the full
console.log('%% begin: ' + suite.allTests().map(t => t.title).join(','));
}
}
- module.exports = R;
+ export default R;
`,
- 'playwright.config.ts': `module.exports = { reporter: './reporter.ts', shard: { current: 1, total: 2 } };`,
+ 'playwright.config.ts': `export default { reporter: './reporter.ts', shard: { current: 1, total: 2 } };`,
'a.test.ts': `
import { test } from '@playwright/test';
for (let i = 0; i < 4; i++)
@@ -379,9 +379,9 @@ test('custom sharding may produce an empty shard', async ({ runInlineTest }) =>
testRun.exclude(t);
}
}
- module.exports = R;
+ export default R;
`,
- 'playwright.config.ts': `module.exports = { reporter: './reporter.ts', shard: { current: 2, total: 2 } };`,
+ 'playwright.config.ts': `export default { reporter: './reporter.ts', shard: { current: 2, total: 2 } };`,
'a.test.ts': `
import { test } from '@playwright/test';
test('t0', async () => {});
@@ -400,13 +400,13 @@ test('multiple reporters declaring custom sharding throws', async ({ runInlineTe
preprocess({ testRun }) { testRun.skipSharding(); }
onError(err) { console.log('%% error: ' + err.message); }
}
- module.exports = A;
+ export default A;
`,
'reporter-b.ts': `
class B { preprocess({ testRun }) { testRun.skipSharding(); } }
- module.exports = B;
+ export default B;
`,
- 'playwright.config.ts': `module.exports = { reporter: [['./reporter-a.ts'], ['./reporter-b.ts']] };`,
+ 'playwright.config.ts': `export default { reporter: [['./reporter-a.ts'], ['./reporter-b.ts']] };`,
'a.test.ts': `
import { test } from '@playwright/test';
test('t', async () => {});
@@ -457,10 +457,10 @@ test('plan.suite exposes setup/teardown dependency projects but they are read-on
console.log('%% ran ' + test.parent.project().name + '/' + test.title);
}
}
- module.exports = Reporter;
+ export default Reporter;
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter.ts',
projects: [
{ name: 'setup', testMatch: /a\\.setup\\.ts/, teardown: 'teardown' },
@@ -512,10 +512,10 @@ test('plan.suite temporarily exposes dependencies without changing final project
console.log('%% ran ' + test.parent.project().name + '/' + test.title);
}
}
- module.exports = Reporter;
+ export default Reporter;
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter.ts',
projects: [
{ name: 'setup', testMatch: /setup\\.spec\\.ts/ },
@@ -556,9 +556,9 @@ test('serial suites expose a serial annotation for custom sharding', async ({ ru
console.log('%% ' + t.title + ':' + t.annotations.filter(a => a.type === 'serial').length);
}
}
- module.exports = Reporter;
+ export default Reporter;
`,
- 'playwright.config.ts': `module.exports = { reporter: './reporter.ts' };`,
+ 'playwright.config.ts': `export default { reporter: './reporter.ts' };`,
'a.test.ts': `
import { test } from '@playwright/test';
test('plain', async () => {});
diff --git a/tests/playwright-test/reporter.spec.ts b/tests/playwright-test/reporter.spec.ts
index 12f5bb5eaf..eb1c3c0def 100644
--- a/tests/playwright-test/reporter.spec.ts
+++ b/tests/playwright-test/reporter.spec.ts
@@ -129,7 +129,7 @@ for (const useIntermediateMergeReport of [false, true] as const) {
const result = await runInlineTest({
'reporter.ts': smallReporterJS,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [
[ './reporter.ts', { onBegin: 'begin-data', onEnd: 'end-data' } ]
],
@@ -168,7 +168,7 @@ onExit
const result = await runInlineTest({
'reporter.ts': smallReporterJS,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -194,12 +194,12 @@ onExit
const result = await runInlineTest({
'reporter.ts': smallReporterJS,
'globalSetup.ts': `
- module.exports = () => {
+ export default () => {
return () => console.log('\\n%%global teardown');
};
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
globalSetup: './globalSetup',
};
@@ -227,7 +227,7 @@ onExit
const result = await runInlineTest({
'node_modules/my-reporter/index.js': smallReporterJS,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: 'my-reporter',
};
`,
@@ -275,7 +275,7 @@ onExit
const result = await runInlineTest({
'reporter.ts': smallReporterJS,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -298,7 +298,7 @@ onExit
const result = await runInlineTest({
'reporter.ts': smallReporterJS,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`
@@ -317,7 +317,7 @@ onExit
const result = await runInlineTest({
'reporter.ts': smallReporterJS,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -340,13 +340,13 @@ onExit
const result = await runInlineTest({
'reporter.ts': smallReporterJS,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
globalSetup: './globalSetup',
};
`,
'globalSetup.ts': `
- module.exports = () => {
+ export default () => {
throw new Error('Oh my!');
};
`,
@@ -407,7 +407,7 @@ onExit
module.exports = Reporter;
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -448,9 +448,9 @@ var import_test = __toModule(require("@playwright/test"));
console.log('parallelIndex: ' + result.parallelIndex)
}
}
- module.exports = Reporter;`,
+ export default Reporter;`,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -466,7 +466,7 @@ var import_test = __toModule(require("@playwright/test"));
test('test and step error should have code snippet', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': smallReporterJS,
- 'playwright.config.ts': `module.exports = { reporter: [['./reporter', { printSteps: true, printErrorSnippet: true }]] };`,
+ 'playwright.config.ts': `export default { reporter: [['./reporter', { printSteps: true, printErrorSnippet: true }]] };`,
'a.spec.js': `
const { test, expect } = require('@playwright/test');
test('test', async () => {
@@ -523,7 +523,7 @@ onExit
test('onError should have code snippet', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': smallReporterJS,
- 'playwright.config.ts': `module.exports = { reporter: [['./reporter', { printSteps: true, printErrorSnippet: true }]] };`,
+ 'playwright.config.ts': `export default { reporter: [['./reporter', { printSteps: true, printErrorSnippet: true }]] };`,
'a.spec.js': `
const { test, expect } = require('@playwright/test');
throw new Error('test');
@@ -559,9 +559,9 @@ onExit
+ ' workerInfo=' + (workerInfo ? typeof workerInfo.workerIndex + '/' + typeof workerInfo.parallelIndex + '/' + workerInfo.project.name : 'undefined'));
}
}
- module.exports = Reporter;
+ export default Reporter;
`,
- 'playwright.config.ts': `module.exports = { projects: [{ name: 'foo' }], reporter: './reporter.ts' };`,
+ 'playwright.config.ts': `export default { projects: [{ name: 'foo' }], reporter: './reporter.ts' };`,
'a.spec.ts': `
import { test as base } from '@playwright/test';
const test = base.extend<{}, { brokenWorker: void }>({
@@ -590,7 +590,7 @@ test('should report a stable test.id', async ({ runInlineTest }) => {
export default Reporter;
`,
'playwright.config.ts': `
- module.exports = { reporter: [[ './reporter.ts' ]] };
+ export default { reporter: [[ './reporter.ts' ]] };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -630,7 +630,7 @@ test('should report annotations from test declaration', async ({ runInlineTest }
}
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -734,7 +734,7 @@ test('tests skipped in serial mode receive onTestBegin/onTestEnd', async ({ runI
const result = await runInlineTest({
'reporter.ts': smallReporterJS,
- 'playwright.config.ts': `module.exports = { reporter: [['./reporter', { printTestStatus: true }]] };`,
+ 'playwright.config.ts': `export default { reporter: [['./reporter', { printTestStatus: true }]] };`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
@@ -775,8 +775,8 @@ test('step attachments are referentially equal to result attachments', async ({
}
}
const result = await runInlineTest({
- 'reporter.ts': `module.exports = ${TestReporter.toString()}`,
- 'playwright.config.ts': `module.exports = { reporter: './reporter' };`,
+ 'reporter.ts': `export default ${TestReporter.toString()}`,
+ 'playwright.config.ts': `export default { reporter: './reporter' };`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
test('test', async ({}, testInfo) => {
@@ -803,8 +803,8 @@ test('step annotations are reported in onStepEnd', async ({ runInlineTest }) =>
}
}
const result = await runInlineTest({
- 'reporter.ts': `module.exports = ${TestReporter.toString()}`,
- 'playwright.config.ts': `module.exports = { reporter: './reporter' };`,
+ 'reporter.ts': `export default ${TestReporter.toString()}`,
+ 'playwright.config.ts': `export default { reporter: './reporter' };`,
'a.spec.ts': `
import { test } from '@playwright/test';
test('test', async () => {
@@ -830,8 +830,8 @@ test('step.attach attachments are reported on right steps', async ({ runInlineTe
}
}
const result = await runInlineTest({
- 'reporter.ts': `module.exports = ${TestReporter.toString()}`,
- 'playwright.config.ts': `module.exports = { reporter: './reporter' };`,
+ 'reporter.ts': `export default ${TestReporter.toString()}`,
+ 'playwright.config.ts': `export default { reporter: './reporter' };`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
test.beforeAll(async () => {
@@ -864,8 +864,8 @@ test('attachments are reported in onStepEnd', { annotation: { type: 'issue', des
}
}
const result = await runInlineTest({
- 'reporter.ts': `module.exports = ${TestReporter.toString()}`,
- 'playwright.config.ts': `module.exports = { reporter: './reporter' };`,
+ 'reporter.ts': `export default ${TestReporter.toString()}`,
+ 'playwright.config.ts': `export default { reporter: './reporter' };`,
'a.spec.ts': `
import { test, expect } from '@playwright/test';
test('test', async ({}, testInfo) => {
@@ -895,8 +895,8 @@ test('should have static annotations on result when all tests are skipped', asyn
}
const result = await runInlineTest({
- 'reporter.ts': `module.exports = ${TestReporter.toString()}`,
- 'playwright.config.ts': `module.exports = { reporter: './reporter' };`,
+ 'reporter.ts': `export default ${TestReporter.toString()}`,
+ 'playwright.config.ts': `export default { reporter: './reporter' };`,
'a.spec.ts': `
import { test } from '@playwright/test';
test.skip('test', {
@@ -912,8 +912,8 @@ test('should have static annotations on result when all tests are skipped', asyn
]);
const resultMany = await runInlineTest({
- 'reporter.ts': `module.exports = ${TestReporter.toString()}`,
- 'playwright.config.ts': `module.exports = { reporter: './reporter' };`,
+ 'reporter.ts': `export default ${TestReporter.toString()}`,
+ 'playwright.config.ts': `export default { reporter: './reporter' };`,
'a.spec.ts': `
import { test } from '@playwright/test';
test.skip('test', {
@@ -959,8 +959,8 @@ test('AggregateError sub-errors are spread into testInfo.errors', async ({ runIn
}
const result = await runInlineTest({
- 'reporter.ts': `module.exports = ${TestReporter.toString()}`,
- 'playwright.config.ts': `module.exports = { reporter: './reporter' };`,
+ 'reporter.ts': `export default ${TestReporter.toString()}`,
+ 'playwright.config.ts': `export default { reporter: './reporter' };`,
'a.spec.ts': `
import { test } from '@playwright/test';
test('basic', () => {
@@ -1021,7 +1021,7 @@ test('--add-reporter should append to configured reporters instead of replacing
'added-reporter.js': `
module.exports = class { onBegin() { console.log('FROM_ADDED_REPORTER'); } };
`,
- 'playwright.config.ts': `module.exports = { reporter: [['./configured-reporter.js']] };`,
+ 'playwright.config.ts': `export default { reporter: [['./configured-reporter.js']] };`,
'a.spec.js': `
const { test } = require('@playwright/test');
test('test', () => {});
diff --git a/tests/playwright-test/resolver.spec.ts b/tests/playwright-test/resolver.spec.ts
index ee1ef144e3..95b9987db7 100644
--- a/tests/playwright-test/resolver.spec.ts
+++ b/tests/playwright-test/resolver.spec.ts
@@ -450,7 +450,7 @@ test('should respect path resolver for JS files when allowJs', async ({ runInlin
});
`,
'foo/bar/util/b.ts': `
- module.exports = { foo: 'foo' };
+ export const foo = 'foo';
`,
});
@@ -477,7 +477,7 @@ test('should not respect path resolver for JS files w/o allowJS', async ({ runIn
});
`,
'foo/bar/util/b.ts': `
- module.exports = { foo: 'foo' };
+ export const foo = 'foo';
`,
});
@@ -511,7 +511,7 @@ test('should respect path resolver for JS and TS files from jsconfig.json', asyn
});
`,
'foo/bar/util/b.ts': `
- module.exports = { foo: 'foo' };
+ export const foo = 'foo';
`,
});
@@ -552,7 +552,7 @@ test('should support extends in tsconfig.json', async ({ runInlineTest }) => {
});
`,
'dir/foo/bar/util/file.ts': `
- module.exports = { foo: 'foo' };
+ export const foo = 'foo';
`,
});
@@ -582,7 +582,7 @@ test('should resolve paths relative to the originating config when extending and
});
`,
'mapped/file.ts': `
- module.exports = { foo: 'foo' };
+ export const foo = 'foo';
`,
});
diff --git a/tests/playwright-test/runner.spec.ts b/tests/playwright-test/runner.spec.ts
index 6013116b7a..1116e294df 100644
--- a/tests/playwright-test/runner.spec.ts
+++ b/tests/playwright-test/runner.spec.ts
@@ -62,7 +62,7 @@ test('it should not allow multiple tests with the same name in multiple files',
test('it should not allow a focused test when forbid-only is used', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
forbidOnly: true,
};
`,
@@ -340,7 +340,7 @@ test('should teardown workers that are redundant', async ({ runInlineTest }) =>
test('should not hang if test suites in worker are inconsistent with runner', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { name: 'project-name' };
+ export default { name: 'project-name' };
`,
'names.js': `
exports.getNames = () => {
@@ -371,7 +371,7 @@ test('should not hang if test suites in worker are inconsistent with runner', as
test('should throw in serial mode if test suites in worker are inconsistent with runner', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { name: 'project-name' };
+ export default { name: 'project-name' };
`,
'a.spec.js': `
import { test, expect } from "@playwright/test";
@@ -402,20 +402,20 @@ test('sigint should stop global setup', async ({ interactWithTestRunner }) => {
const testProcess = await interactWithTestRunner({
'playwright.config.ts': `
- module.exports = {
+ export default {
globalSetup: './globalSetup',
globalTeardown: './globalTeardown.ts',
};
`,
'globalSetup.ts': `
- module.exports = () => {
+ export default () => {
console.log('Global setup');
console.log('%%SEND-SIGINT%%');
return new Promise(f => setTimeout(f, 30000));
};
`,
'globalTeardown.ts': `
- module.exports = () => {
+ export default () => {
console.log('Global teardown');
};
`,
@@ -460,7 +460,7 @@ test('sigint should stop plugins', async ({ interactWithTestRunner }) => {
console.log('Plugin2 teardown');
}
}));
- module.exports = {
+ export default {
'@playwright/test': { plugins }
};
`,
@@ -510,7 +510,7 @@ test('sigint should stop plugins 2', async ({ interactWithTestRunner }) => {
console.log('Plugin2 teardown');
}
}));
- module.exports = { '@playwright/test': { plugins } };
+ export default { '@playwright/test': { plugins } };
`,
'a.spec.js': `
import { test, expect } from '@playwright/test';
diff --git a/tests/playwright-test/shard.spec.ts b/tests/playwright-test/shard.spec.ts
index a700812e0b..f8ee78c8f7 100644
--- a/tests/playwright-test/shard.spec.ts
+++ b/tests/playwright-test/shard.spec.ts
@@ -220,7 +220,7 @@ test('should work with workers=1 and --fully-parallel', async ({ runInlineTest }
test('should skip dependency when project is sharded out', async ({ runInlineTest }) => {
const tests = {
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'setup1', testMatch: /setup.ts/ },
{ name: 'tests1', dependencies: ['setup1'] },
diff --git a/tests/playwright-test/stdio.spec.ts b/tests/playwright-test/stdio.spec.ts
index b29ef2a07c..f3ab5f4801 100644
--- a/tests/playwright-test/stdio.spec.ts
+++ b/tests/playwright-test/stdio.spec.ts
@@ -65,7 +65,7 @@ test('should get stdio from worker fixture teardown', async ({ runInlineTest })
test('should ignore stdio when quiet', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { quiet: true };
+ export default { quiet: true };
`,
'a.spec.js': `
import { test, expect } from '@playwright/test';
diff --git a/tests/playwright-test/test-extend.spec.ts b/tests/playwright-test/test-extend.spec.ts
index cc6bf18f4a..d19b50a648 100644
--- a/tests/playwright-test/test-extend.spec.ts
+++ b/tests/playwright-test/test-extend.spec.ts
@@ -60,7 +60,7 @@ test('test.extend should work', async ({ runInlineTest }) => {
export const test2 = base.extend(createDerivedFixtures('e2'));
`,
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ use: { suffix: 'base1' } },
{ use: { suffix: 'base2' } },
] };
@@ -125,7 +125,7 @@ test('test.extend should work', async ({ runInlineTest }) => {
test('config should override options but not fixtures', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: { param: 'config' },
};
`,
@@ -163,7 +163,7 @@ test('config should override options but not fixtures', async ({ runInlineTest }
test('mergeTests should be able to merge', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: { param: 'from-config' },
};
`,
@@ -234,7 +234,7 @@ test('mergeTests should print nice message when used as extend', async ({ runInl
test('test.use() with undefined should not be ignored', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: { option1: 'config' },
};
`,
@@ -286,7 +286,7 @@ test('test.use() with undefined should not be ignored', async ({ runInlineTest }
test('undefined values in config and test.use should be reverted to default', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
use: { option1: undefined, option2: undefined, option4: 'from-config' },
};
`,
diff --git a/tests/playwright-test/test-grep.spec.ts b/tests/playwright-test/test-grep.spec.ts
index 39bb50d02c..5a907157b3 100644
--- a/tests/playwright-test/test-grep.spec.ts
+++ b/tests/playwright-test/test-grep.spec.ts
@@ -19,7 +19,7 @@ import { test, expect } from './playwright-test-fixtures';
test('config.grep should work', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { grep: /test1/ };
+ export default { grep: /test1/ };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -35,7 +35,7 @@ test('config.grep should work', async ({ runInlineTest }) => {
test('config.grepInvert should work', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { grepInvert: /test1/ };
+ export default { grepInvert: /test1/ };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -51,7 +51,7 @@ test('config.grepInvert should work', async ({ runInlineTest }) => {
test('project.grep should work', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [ { grep: /test1/ } ] };
+ export default { projects: [ { grep: /test1/ } ] };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -67,7 +67,7 @@ test('project.grep should work', async ({ runInlineTest }) => {
test('project.grepInvert should work', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [ { grepInvert: /test1/ } ] };
+ export default { projects: [ { grepInvert: /test1/ } ] };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -83,7 +83,7 @@ test('project.grepInvert should work', async ({ runInlineTest }) => {
test('config.grep should intersect with --grep and --grepInvert', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { grep: /test./, grepInvert: /test4/ };
+ export default { grep: /test./, grepInvert: /test4/ };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
diff --git a/tests/playwright-test/test-ignore.spec.ts b/tests/playwright-test/test-ignore.spec.ts
index 17e3b3adae..f266c199f4 100644
--- a/tests/playwright-test/test-ignore.spec.ts
+++ b/tests/playwright-test/test-ignore.spec.ts
@@ -42,7 +42,7 @@ test('should ignore a test', async ({ runInlineTest }) => {
const result = await runInlineTest({
...tests,
'playwright.config.ts': `
- module.exports = { testIgnore: 'b.test.ts' };
+ export default { testIgnore: 'b.test.ts' };
`,
});
expect(result.passed).toBe(2);
@@ -52,7 +52,7 @@ test('should ignore a test', async ({ runInlineTest }) => {
test('should ignore a folder', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { testIgnore: 'folder/**' };
+ export default { testIgnore: 'folder/**' };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -102,7 +102,7 @@ test('should filter tests', async ({ runInlineTest }) => {
const result = await runInlineTest({
...tests,
'playwright.config.ts': `
- module.exports = { testIgnore: 'c.test.*' };
+ export default { testIgnore: 'c.test.*' };
`,
});
expect(result.passed).toBe(2);
@@ -113,7 +113,7 @@ test('should use a different test match', async ({ runInlineTest }) => {
const result = await runInlineTest({
...tests,
'playwright.config.ts': `
- module.exports = { testMatch: '[a|b].test.ts' };
+ export default { testMatch: '[a|b].test.ts' };
`,
});
expect(result.passed).toBe(2);
@@ -123,7 +123,7 @@ test('should use a different test match', async ({ runInlineTest }) => {
test('should use an array for testMatch', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { testMatch: ['b.test.ts', /\\${path.sep}a.[tes]{4}.TS$/i] };
+ export default { testMatch: ['b.test.ts', /\\${path.sep}a.[tes]{4}.TS$/i] };
`,
'dir/a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -147,7 +147,7 @@ test('should match absolute path', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
import * as path from 'path';
- module.exports = { testDir: path.join(__dirname, 'dir'), testMatch: /dir\\${path.sep}a/ };
+ export default { testDir: path.join(__dirname, 'dir'), testMatch: /dir\\${path.sep}a/ };
`,
'dir/a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -171,7 +171,7 @@ test('should match cli string argument', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
import * as path from 'path';
- module.exports = { testDir: path.join(__dirname, 'dir') };
+ export default { testDir: path.join(__dirname, 'dir') };
`,
'dir/a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -275,7 +275,7 @@ test('should match by directory', async ({ runInlineTest }) => {
test('should ignore node_modules even with custom testIgnore', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { testIgnore: 'a.test.ts' };
+ export default { testIgnore: 'a.test.ts' };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -301,7 +301,7 @@ test('should ignore node_modules even with custom testIgnore', async ({ runInlin
test('should only match files with JS/TS file extensions', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { testMatch: /foobar/ };
+ export default { testMatch: /foobar/ };
`,
'foobar.test.ts': `
import { test, expect } from '@playwright/test';
@@ -352,7 +352,7 @@ test('should always work with unix separators', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
import * as path from 'path';
- module.exports = { testDir: path.join(__dirname, 'dir') };
+ export default { testDir: path.join(__dirname, 'dir') };
`,
'dir/a.test.ts': `
import { test, expect } from '@playwright/test';
diff --git a/tests/playwright-test/test-list.spec.ts b/tests/playwright-test/test-list.spec.ts
index 371c8bf1b9..f185a07705 100644
--- a/tests/playwright-test/test-list.spec.ts
+++ b/tests/playwright-test/test-list.spec.ts
@@ -20,7 +20,7 @@ import { test, expect } from './playwright-test-fixtures';
const varietyWorkspace = {
'playwright.config.ts': `
- module.exports = { projects: [{ name: 'p1' }, { name: 'p2' }], testDir: 'tests', };
+ export default { projects: [{ name: 'p1' }, { name: 'p2' }], testDir: 'tests', };
`,
'dir/test.list': `
# this is a multiline comment
@@ -230,7 +230,7 @@ test('--test-list with nested group entry should run only tests in that nested g
test('--test-list should not load files not in the list', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { testDir: '.' };
+ export default { testDir: '.' };
`,
'test.list': `
compiles.test.ts
diff --git a/tests/playwright-test/test-locks.spec.ts b/tests/playwright-test/test-locks.spec.ts
index cf2cf96098..1ee7721f21 100644
--- a/tests/playwright-test/test-locks.spec.ts
+++ b/tests/playwright-test/test-locks.spec.ts
@@ -47,7 +47,7 @@ const lockedTest = (name: string, delay: number, lock?: string | string[]) => `
test('should not run tests with the same lock at the same time', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { fullyParallel: true };
+ export default { fullyParallel: true };
`,
'a.test.ts': `
import { test } from '@playwright/test';
@@ -66,7 +66,7 @@ test('should not run tests with the same lock at the same time', async ({ runInl
test('should run tests with different locks at the same time', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { fullyParallel: true };
+ export default { fullyParallel: true };
`,
'helper.ts': `
import fs from 'fs';
@@ -101,7 +101,7 @@ test('should run tests with different locks at the same time', async ({ runInlin
test('should not run tests with the same lock from different projects at the same time', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'project1' },
{ name: 'project2' },
@@ -125,7 +125,7 @@ test('should not run tests with the same lock from different projects at the sam
test('should support locks declared and configured on describe groups', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { fullyParallel: true };
+ export default { fullyParallel: true };
`,
'a.test.ts': `
import { test } from '@playwright/test';
@@ -147,7 +147,7 @@ test('should support locks declared and configured on describe groups', async ({
test('should support multiple locks on a single test', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { fullyParallel: true };
+ export default { fullyParallel: true };
`,
'a.test.ts': `
import { test } from '@playwright/test';
@@ -188,7 +188,7 @@ test('should hold the lock for the whole file group in default mode', async ({ r
test('should respect locks on tests from a parallel suite with beforeAll hooks', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { fullyParallel: true };
+ export default { fullyParallel: true };
`,
'a.test.ts': `
import { test } from '@playwright/test';
@@ -213,7 +213,7 @@ test('should respect locks on tests from a parallel suite with beforeAll hooks',
test('should not count waiting for a lock towards the test timeout', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { timeout: 3000 };
+ export default { timeout: 3000 };
`,
'a.test.ts': `
import { test } from '@playwright/test';
diff --git a/tests/playwright-test/test-modifiers.spec.ts b/tests/playwright-test/test-modifiers.spec.ts
index 8ab98cc47a..158c6028d2 100644
--- a/tests/playwright-test/test-modifiers.spec.ts
+++ b/tests/playwright-test/test-modifiers.spec.ts
@@ -659,7 +659,7 @@ test('should report skipped tests in-order with correct properties', async ({ ru
export default Reporter;
`,
'playwright.config.ts': `
- module.exports = { reporter: [['./reporter.ts']] };
+ export default { reporter: [['./reporter.ts']] };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
diff --git a/tests/playwright-test/test-output-dir.spec.ts b/tests/playwright-test/test-output-dir.spec.ts
index 7768bd5e86..f5523692a7 100644
--- a/tests/playwright-test/test-output-dir.spec.ts
+++ b/tests/playwright-test/test-output-dir.spec.ts
@@ -21,7 +21,7 @@ import { test, expect } from './playwright-test-fixtures';
test('should work and remove non-failures', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = {
+ export default {
name: 'chromium',
preserveOutput: 'failures-only',
testDir: 'dir',
@@ -150,7 +150,7 @@ test('should include the project name', async ({ runInlineTest }) => {
});
`,
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{},
{ name: 'foo' },
{ name: 'foo' },
@@ -228,7 +228,7 @@ test('should include path option in snapshot', async ({ runInlineTest }) => {
});
`,
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'foo' },
] };
`,
@@ -257,7 +257,7 @@ test('should error if outputPath is resolved to outside of parent', async ({ run
});
`,
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'foo' },
] };
`,
diff --git a/tests/playwright-test/test-parallel.spec.ts b/tests/playwright-test/test-parallel.spec.ts
index 394969043a..137eacab0e 100644
--- a/tests/playwright-test/test-parallel.spec.ts
+++ b/tests/playwright-test/test-parallel.spec.ts
@@ -121,7 +121,7 @@ test('test.describe.parallel should work in describe', async ({ runInlineTest })
test('config.fullyParallel should work', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { fullyParallel: true };
+ export default { fullyParallel: true };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -151,7 +151,7 @@ test('config.fullyParallel should work', async ({ runInlineTest }) => {
test('project.fullyParallel should work', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [ { fullyParallel: true } ] };
+ export default { projects: [ { fullyParallel: true } ] };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
diff --git a/tests/playwright-test/test-serial.spec.ts b/tests/playwright-test/test-serial.spec.ts
index 5059b8108b..34946195ae 100644
--- a/tests/playwright-test/test-serial.spec.ts
+++ b/tests/playwright-test/test-serial.spec.ts
@@ -371,7 +371,7 @@ test('test.describe.serial should work inside test.describe.parallel', async ({
test('test.describe.serial should work with fullyParallel', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { fullyParallel: true };
+ export default { fullyParallel: true };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
diff --git a/tests/playwright-test/test-server.spec.ts b/tests/playwright-test/test-server.spec.ts
index 9d1fe10133..760da65287 100644
--- a/tests/playwright-test/test-server.spec.ts
+++ b/tests/playwright-test/test-server.spec.ts
@@ -132,7 +132,7 @@ test('should list tests with testIdAttribute', async ({ startTestServer, writeFi
test('foo', () => {});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [{
name: 'chromium',
use: {
@@ -157,7 +157,7 @@ test('should list non-default projects', async ({ startTestServer, writeFiles })
test('foo', () => {});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
projects: [
{ name: 'default' },
{ name: 'non-default', default: false },
diff --git a/tests/playwright-test/test-step.spec.ts b/tests/playwright-test/test-step.spec.ts
index af90f0215d..d86d20fa4c 100644
--- a/tests/playwright-test/test-step.spec.ts
+++ b/tests/playwright-test/test-step.spec.ts
@@ -117,7 +117,7 @@ test('should report api step hierarchy', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -162,7 +162,7 @@ test('should report before hooks step error', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -192,7 +192,7 @@ test('should not report nested after hooks', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -242,7 +242,7 @@ test('should report test.step from fixtures', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': expectReporterJS,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -290,7 +290,7 @@ test('should report expect step locations', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -314,7 +314,7 @@ test('should report custom expect steps', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: [['./reporter']],
};
`,
@@ -485,7 +485,7 @@ test('should mark step as failed when soft expect fails', async ({ runInlineTest
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -522,7 +522,7 @@ test('should nest steps based on zones', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -598,7 +598,7 @@ test('should not mark page.close as failed when page.click fails', async ({ runI
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -645,7 +645,7 @@ fixture | Fixture "browser"
test('should not propagate errors from within toPass', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
- 'playwright.config.ts': `module.exports = { reporter: './reporter', };`,
+ 'playwright.config.ts': `export default { reporter: './reporter', };`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('pass', async () => {
@@ -673,7 +673,7 @@ hook |After Hooks
test('should show final toPass error', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
- 'playwright.config.ts': `module.exports = { reporter: './reporter', };`,
+ 'playwright.config.ts': `export default { reporter: './reporter', };`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('fail', async () => {
@@ -700,7 +700,7 @@ hook |Worker Cleanup
test('should propagate nested soft errors', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
- 'playwright.config.ts': `module.exports = { reporter: './reporter', };`,
+ 'playwright.config.ts': `export default { reporter: './reporter', };`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('fail', async () => {
@@ -744,7 +744,7 @@ hook |Worker Cleanup
test('should not propagate nested hard errors', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
- 'playwright.config.ts': `module.exports = { reporter: './reporter', };`,
+ 'playwright.config.ts': `export default { reporter: './reporter', };`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('fail', async () => {
@@ -788,7 +788,7 @@ hook |Worker Cleanup
test('should step w/o box', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
- 'playwright.config.ts': `module.exports = { reporter: [['./reporter', { printErrorLocation: true }]], };`,
+ 'playwright.config.ts': `export default { reporter: [['./reporter', { printErrorLocation: true }]], };`,
'a.test.ts':
` /*1*/ import { test, expect } from '@playwright/test';
/*2*/ test('fail', async () => {
@@ -821,7 +821,7 @@ hook |Worker Cleanup
test('should step w/ box', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
- 'playwright.config.ts': `module.exports = { reporter: [['./reporter', { printErrorLocation: true }]], };`,
+ 'playwright.config.ts': `export default { reporter: [['./reporter', { printErrorLocation: true }]], };`,
'a.test.ts':
` /*1*/ import { test, expect } from '@playwright/test';
/*2*/ test('fail', async () => {
@@ -854,7 +854,7 @@ hook |Worker Cleanup
test('should soft step w/ box', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
- 'playwright.config.ts': `module.exports = { reporter: [['./reporter', { printErrorLocation: true }]], };`,
+ 'playwright.config.ts': `export default { reporter: [['./reporter', { printErrorLocation: true }]], };`,
'a.test.ts':
` /*1*/ import { test, expect } from '@playwright/test';
/*2*/ test('fail', async () => {
@@ -888,7 +888,7 @@ test('should not generate dupes for named expects', async ({ runInlineTest }) =>
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -925,7 +925,7 @@ test('step inside toPass', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -973,7 +973,7 @@ test('library API call inside toPass', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -1022,7 +1022,7 @@ test('library API call inside expect.poll', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -1075,7 +1075,7 @@ test('web assertion inside expect.poll', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -1127,7 +1127,7 @@ test('should report expect steps', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -1179,7 +1179,7 @@ test('should report api steps', async ({ runInlineTest, server }) => {
});
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
- 'playwright.config.ts': `module.exports = { reporter: [['./reporter', { skipErrorMessage: true }]] };`,
+ 'playwright.config.ts': `export default { reporter: [['./reporter', { skipErrorMessage: true }]] };`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('pass', async ({ page, request }) => {
@@ -1266,7 +1266,7 @@ test('should report api step failure', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -1304,7 +1304,7 @@ fixture | Fixture "browser"
test('should show nice stacks for locators', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
- 'playwright.config.ts': `module.exports = { reporter: [['./reporter', { printErrorLocation: true }]] };`,
+ 'playwright.config.ts': `export default { reporter: [['./reporter', { printErrorLocation: true }]] };`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('pass', async ({ page }) => {
@@ -1350,7 +1350,7 @@ test('should allow passing location to test.step', async ({ runInlineTest, runTS
}
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
@@ -1387,7 +1387,7 @@ hook |After Hooks
test('should show tracing.group nested inside test.step', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
- 'playwright.config.ts': `module.exports = { reporter: [['./reporter', { printErrorLocation: true }]] };`,
+ 'playwright.config.ts': `export default { reporter: [['./reporter', { printErrorLocation: true }]] };`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('pass', async ({ page }) => {
@@ -1430,7 +1430,7 @@ test('calls from waitForEvent callback should be under its parent step', {
}, async ({ runInlineTest, server }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
- 'playwright.config.ts': `module.exports = { reporter: './reporter' };`,
+ 'playwright.config.ts': `export default { reporter: './reporter' };`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('waitForResponse step nesting', async ({ page }) => {
@@ -1485,7 +1485,7 @@ test('reading network request / response should not be listed as step', {
}, async ({ runInlineTest, server }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
- 'playwright.config.ts': `module.exports = { reporter: './reporter' };`,
+ 'playwright.config.ts': `export default { reporter: './reporter' };`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('waitForResponse step nesting', async ({ page }) => {
@@ -1524,7 +1524,7 @@ test('calls from page.route callback should be under its parent step', {
}, async ({ runInlineTest, server }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
- 'playwright.config.ts': `module.exports = { reporter: './reporter' };`,
+ 'playwright.config.ts': `export default { reporter: './reporter' };`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('waitForResponse step nesting', async ({ page }) => {
@@ -1567,7 +1567,7 @@ pw:api | Close context
test('test.step.skip should work', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
- 'playwright.config.ts': `module.exports = { reporter: './reporter' };`,
+ 'playwright.config.ts': `export default { reporter: './reporter' };`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('test', async ({ }) => {
@@ -1605,7 +1605,7 @@ hook |After Hooks
test('skip test.step.skip body', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
- 'playwright.config.ts': `module.exports = { reporter: './reporter' };`,
+ 'playwright.config.ts': `export default { reporter: './reporter' };`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('test', async ({ }) => {
@@ -1634,7 +1634,7 @@ hook |After Hooks
test('step.skip should work at runtime', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
- 'playwright.config.ts': `module.exports = { reporter: './reporter' };`,
+ 'playwright.config.ts': `export default { reporter: './reporter' };`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('test', async ({ }) => {
@@ -1709,7 +1709,7 @@ test('step.titlePath works in custom matcher', { annotation: { type: 'issue', de
test('should differentiate test.skip and step.skip', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
- 'playwright.config.ts': `module.exports = { reporter: './reporter' };`,
+ 'playwright.config.ts': `export default { reporter: './reporter' };`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
test('test', async ({ }) => {
@@ -1729,7 +1729,7 @@ test('should differentiate test.skip and step.skip', async ({ runInlineTest }) =
test('show api calls inside expects', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
- 'playwright.config.ts': `module.exports = { reporter: './reporter' };`,
+ 'playwright.config.ts': `export default { reporter: './reporter' };`,
'a.test.ts': `
import { test, expect as baseExpect } from '@playwright/test';
@@ -1793,7 +1793,7 @@ pw:api | Close context
test('should box fixtures', async ({ runInlineTest }) => {
const result = await runInlineTest({
'reporter.ts': stepIndentReporter,
- 'playwright.config.ts': `module.exports = { reporter: './reporter' };`,
+ 'playwright.config.ts': `export default { reporter: './reporter' };`,
'a.test.ts': `
import { test as baseTest, expect, type Page } from '@playwright/test';
@@ -1875,7 +1875,7 @@ test('should report step params', async ({ runInlineTest }) => {
}
`,
'playwright.config.ts': `
- module.exports = { reporter: './reporter' };
+ export default { reporter: './reporter' };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -1911,7 +1911,7 @@ test('should report step subtitle', async ({ runInlineTest }) => {
}
`,
'playwright.config.ts': `
- module.exports = { reporter: './reporter' };
+ export default { reporter: './reporter' };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -1943,7 +1943,7 @@ test('should report input step params', async ({ runInlineTest }) => {
}
`,
'playwright.config.ts': `
- module.exports = { reporter: './reporter' };
+ export default { reporter: './reporter' };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -1995,7 +1995,7 @@ test('should truncate long step params', async ({ runInlineTest }) => {
}
`,
'playwright.config.ts': `
- module.exports = { reporter: './reporter' };
+ export default { reporter: './reporter' };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
diff --git a/tests/playwright-test/test-tag.spec.ts b/tests/playwright-test/test-tag.spec.ts
index e3967a8b98..352c5e7b24 100644
--- a/tests/playwright-test/test-tag.spec.ts
+++ b/tests/playwright-test/test-tag.spec.ts
@@ -35,7 +35,7 @@ test('should have correct tags', async ({ runInlineTest }) => {
}
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
tag: '@global',
};
@@ -95,7 +95,7 @@ test('should have correct tags', async ({ runInlineTest }) => {
test('config.grep should work', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { grep: /@tag1/ };
+ export default { grep: /@tag1/ };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -111,7 +111,7 @@ test('config.grep should work', async ({ runInlineTest }) => {
test('config.project.grep should work', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [
+ export default { projects: [
{ name: 'p1' },
{ name: 'p2', grep: /@tag1/ }
] };
@@ -170,7 +170,7 @@ test('should be included in testInfo', async ({ runInlineTest }, testInfo) => {
test('should be included in testInfo if coming from describe or global tag', async ({ runInlineTest }, testInfo) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { tag: ['@global1', '@global2'] };
+ export default { tag: ['@global1', '@global2'] };
`,
'a.test.ts': `
import { test, expect } from '@playwright/test';
@@ -203,7 +203,7 @@ test('should not parse file names as tags', async ({ runInlineTest }) => {
}
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
reporter: './reporter',
};
`,
diff --git a/tests/playwright-test/test-use.spec.ts b/tests/playwright-test/test-use.spec.ts
index 1687cbe2e7..dd64d58ccb 100644
--- a/tests/playwright-test/test-use.spec.ts
+++ b/tests/playwright-test/test-use.spec.ts
@@ -151,7 +151,7 @@ test('should use options from the config', async ({ runInlineTest }) => {
});
`,
'playwright.config.ts': `
- module.exports = { use: { foo: 'bar' } };
+ export default { use: { foo: 'bar' } };
`,
'a.test.ts': `
import { test, expect } from './helper';
diff --git a/tests/playwright-test/to-have-screenshot.spec.ts b/tests/playwright-test/to-have-screenshot.spec.ts
index c725b2a130..3e31296d3d 100644
--- a/tests/playwright-test/to-have-screenshot.spec.ts
+++ b/tests/playwright-test/to-have-screenshot.spec.ts
@@ -329,7 +329,7 @@ test('should report toHaveScreenshot step with expectation name in title', async
console.log('%% end [' + step.category + '] ' + step.title);
}
}
- module.exports = Reporter;
+ export default Reporter;
`,
...playwrightConfig({ reporter: './reporter' }),
'a.spec.js': `
@@ -908,7 +908,7 @@ test('should attach missing expectations to right step', async ({ runInlineTest
console.log(\`%%[\${step.category}] \${step.title}: \${step.attachments.map(a => a.name).join(", ")}\`);
}
}
- module.exports = Reporter;
+ export default Reporter;
`,
...playwrightConfig({
reporter: [['dot'], ['./reporter']],
diff --git a/tests/playwright-test/types-2.spec.ts b/tests/playwright-test/types-2.spec.ts
index 6fb76ec658..4f656e0710 100644
--- a/tests/playwright-test/types-2.spec.ts
+++ b/tests/playwright-test/types-2.spec.ts
@@ -177,7 +177,7 @@ test('test.extend options should check types', async ({ runTSC }) => {
// @ts-expect-error
use: { unknown: true },
});
- module.exports = configs;
+ export default configs;
`,
'a.spec.ts': `
import { test, test1, test2, test3, test4, test6 } from './helper';
diff --git a/tests/playwright-test/ui-mode-metadata.spec.ts b/tests/playwright-test/ui-mode-metadata.spec.ts
index eda38bff3c..8c35a5f636 100644
--- a/tests/playwright-test/ui-mode-metadata.spec.ts
+++ b/tests/playwright-test/ui-mode-metadata.spec.ts
@@ -19,7 +19,7 @@ import { test, expect } from './ui-mode-fixtures';
test('should render html report git info metadata', async ({ runUITest }) => {
const { page } = await runUITest({
'reporter.ts': `
- module.exports = class Reporter {
+ export default class Reporter {
onBegin(config, suite) {
console.log('ci.link:', config.metadata['ci'].commitHref);
}
diff --git a/tests/playwright-test/ui-mode-test-network-tab.spec.ts b/tests/playwright-test/ui-mode-test-network-tab.spec.ts
index da3369f843..e33659e4fc 100644
--- a/tests/playwright-test/ui-mode-test-network-tab.spec.ts
+++ b/tests/playwright-test/ui-mode-test-network-tab.spec.ts
@@ -362,7 +362,7 @@ test('should not duplicate network entries from beforeAll', {
}, async ({ runUITest, server }) => {
const { page } = await runUITest({
'playwright.config.ts': `
- module.exports = { use: { trace: 'on' } };
+ export default { use: { trace: 'on' } };
`,
'a.spec.ts': `
import { test as base, expect, request, type APIRequestContext } from '@playwright/test';
diff --git a/tests/playwright-test/ui-mode-test-output.spec.ts b/tests/playwright-test/ui-mode-test-output.spec.ts
index 7f9256aeed..42e8ae7acb 100644
--- a/tests/playwright-test/ui-mode-test-output.spec.ts
+++ b/tests/playwright-test/ui-mode-test-output.spec.ts
@@ -272,7 +272,7 @@ test('should print web server output', async ({ runUITest }, { workerIndex }) =>
});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(serverPath)} ${port}',
port: ${port},
diff --git a/tests/playwright-test/web-server.spec.ts b/tests/playwright-test/web-server.spec.ts
index 13a3952d6d..83dfb34865 100644
--- a/tests/playwright-test/web-server.spec.ts
+++ b/tests/playwright-test/web-server.spec.ts
@@ -37,7 +37,7 @@ test('should create a server', async ({ runInlineTest }, { workerIndex }) => {
});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(SIMPLE_SERVER_PATH)} ${port}',
port: ${port},
@@ -48,7 +48,7 @@ test('should create a server', async ({ runInlineTest }, { workerIndex }) => {
`,
'globalSetup.ts': `
import { expect } from '@playwright/test';
- module.exports = async (config) => {
+ export default async (config) => {
expect(config.webServer.port, "For backwards compatibility reasons, we ensure this shows up.").toBe(${port});
const response = await fetch("http://localhost:${port}/hello");
@@ -62,7 +62,7 @@ test('should create a server', async ({ runInlineTest }, { workerIndex }) => {
};
`,
'globalTeardown.ts': `
- module.exports = async () => {
+ export default async () => {
const response = await fetch("http://localhost:${port}/hello");
console.log('globalTeardown-status-' + response.status)
await response.text();
@@ -99,7 +99,7 @@ test('should create a server with environment variables', async ({ runInlineTest
});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(SIMPLE_SERVER_PATH)} ${port}',
port: ${port},
@@ -132,7 +132,7 @@ test('should run web server with PLAYWRIGHT_TEST=1 environment variable', {
});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(SIMPLE_SERVER_PATH)} ${port}',
port: ${port},
@@ -161,7 +161,7 @@ test('should allow to unset PLAYWRIGHT_TEST environment variable', {
});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(SIMPLE_SERVER_PATH)} ${port}',
port: ${port},
@@ -191,7 +191,7 @@ test('should default cwd to config directory', async ({ runInlineTest }, testInf
});
`,
'foo/playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(relativeSimpleServerPath)} ${port}',
port: ${port},
@@ -219,7 +219,7 @@ test('should resolve cwd wrt config directory', async ({ runInlineTest }, testIn
});
`,
'foo/playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(relativeSimpleServerPath)} ${port}',
port: ${port},
@@ -249,7 +249,7 @@ test('should create a server with url', async ({ runInlineTest }, { workerIndex
});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(path.join(__dirname, 'assets', 'simple-server-with-ready-route.js'))} ${port}',
url: 'http://localhost:${port}/ready'
@@ -274,7 +274,7 @@ test('should time out waiting for a server', async ({ runInlineTest }, { workerI
});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(SIMPLE_SERVER_PATH)} ${port} 1000',
port: ${port},
@@ -299,7 +299,7 @@ test('should time out waiting for a server with url', async ({ runInlineTest },
});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(path.join(__dirname, 'assets', 'simple-server-with-ready-route.js'))} ${port}',
url: 'http://localhost:${port}/ready',
@@ -328,7 +328,7 @@ test('should be able to specify the baseURL without the server', async ({ runInl
});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
use: {
baseURL: 'http://localhost:${port}',
}
@@ -358,7 +358,7 @@ test('should be able to specify a custom baseURL with the server', async ({ runI
});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(SIMPLE_SERVER_PATH)} ${webServerPort}',
port: ${webServerPort},
@@ -392,7 +392,7 @@ test('should be able to use an existing server when reuseExistingServer:true', a
});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(SIMPLE_SERVER_PATH)} ${port}',
port: ${port},
@@ -425,7 +425,7 @@ test('should throw when a server is already running on the given port and strict
});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(SIMPLE_SERVER_PATH)} ${port}',
port: ${port},
@@ -456,7 +456,7 @@ for (const host of ['localhost', '127.0.0.1', '0.0.0.0']) {
});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node -e "process.exit(1)"',
port: ${port},
@@ -508,7 +508,7 @@ test('should send Accept header', async ({ runInlineTest, server }) => {
});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(SIMPLE_SERVER_PATH)} ${server.PORT}',
url: 'http://localhost:${server.PORT}/hello',
@@ -535,7 +535,7 @@ test('should follow redirects', async ({ runInlineTest, server }) => {
});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(SIMPLE_SERVER_PATH)} ${server.PORT}',
url: 'http://localhost:${server.PORT}/redirect',
@@ -562,7 +562,7 @@ test('should create multiple servers', async ({ runInlineTest }, { workerIndex }
});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: [
{
command: 'node ${JSON.stringify(SIMPLE_SERVER_PATH)} ${port}',
@@ -579,7 +579,7 @@ test('should create multiple servers', async ({ runInlineTest }, { workerIndex }
`,
'globalSetup.ts': `
import { expect } from '@playwright/test';
- module.exports = async (config) => {
+ export default async (config) => {
expect(config.webServer, "The public API defines this type as singleton or null, so if using array style we fallback to null to avoid having the type lie to the user.").toBe(null);
const response = await fetch("http://localhost:${port}/hello");
console.log('globalSetup-status-' + response.status);
@@ -592,7 +592,7 @@ test('should create multiple servers', async ({ runInlineTest }, { workerIndex }
};
`,
'globalTeardown.ts': `
- module.exports = async () => {
+ export default async () => {
const response = await fetch("http://localhost:${port}/hello");
console.log('globalTeardown-status-' + response.status);
await response.text();
@@ -625,7 +625,7 @@ test.describe('baseURL with plugins', () => {
`,
'playwright.config.ts': `
import { webServer } from 'playwright/lib/runner';
- module.exports = {
+ export default {
_plugins: [
webServer({
command: 'node ${JSON.stringify(SIMPLE_SERVER_PATH)} ${port}',
@@ -650,7 +650,7 @@ test.describe('baseURL with plugins', () => {
`,
'playwright.config.ts': `
import { webServer } from 'playwright/lib/runner';
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(SIMPLE_SERVER_PATH)} ${port}',
port: ${port},
@@ -677,7 +677,7 @@ test('should treat 3XX as available server', async ({ runInlineTest }, { workerI
test('pass', async ({}) => {});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(SIMPLE_SERVER_PATH)} ${port}',
url: 'http://localhost:${port}/redirect',
@@ -700,7 +700,7 @@ test('should check ipv4 and ipv6 with happy eyeballs when URL is passed', async
test('pass', async ({}) => {});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node -e "require(\\'http\\').createServer((req, res) => res.end()).listen(${port}, \\'127.0.0.1\\')"',
url: 'http://localhost:${port}/',
@@ -723,7 +723,7 @@ test('should forward stdout when set to "pipe"', async ({ runInlineTest }, { wor
test('pass', async ({}) => {});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(SIMPLE_SERVER_PATH)} ${port}',
port: ${port},
@@ -746,7 +746,7 @@ test('should be able to ignore "stderr"', async ({ runInlineTest }, { workerInde
test('pass', async ({}) => {});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(SIMPLE_SERVER_PATH)} ${port}',
port: ${port},
@@ -774,7 +774,7 @@ test('should forward stdout when set to "pipe" before server is ready', async ({
test('pass', async ({}) => {});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node web-server.js',
port: 12345,
@@ -823,7 +823,7 @@ test.describe('gracefulShutdown option', () => {
test('pass', async ({}) => {});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'echo some-precondition && node web-server.js ${port}',
port: ${port},
@@ -869,7 +869,7 @@ test.describe('name option', () => {
test('pass', async ({}) => {});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: [
{
command: 'node ${JSON.stringify(SIMPLE_SERVER_PATH)} ${port}',
@@ -900,7 +900,7 @@ test.describe('name option', () => {
test('pass', async ({}) => {});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: {
command: 'node ${JSON.stringify(SIMPLE_SERVER_PATH)} ${port}',
port: ${port},
@@ -920,7 +920,7 @@ test('should throw helpful error when command is empty', async ({ runInlineTest
test('pass', async ({}) => {});
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: [
{
command: '',
@@ -946,7 +946,7 @@ for (const stdio of ['stdout', 'stderr']) {
setTimeout(() => {}, 100000);
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: [
{
command: 'node server.js',
@@ -973,7 +973,7 @@ for (const stdio of ['stdout', 'stderr']) {
setTimeout(() => {}, 100000);
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: [
{
command: 'node server.js',
@@ -1001,7 +1001,7 @@ for (const stdio of ['stdout', 'stderr']) {
setTimeout(() => {}, 100000);
`,
'playwright.config.ts': `
- module.exports = {
+ export default {
webServer: [
{
command: 'node server.js',
diff --git a/tests/playwright-test/worker-index.spec.ts b/tests/playwright-test/worker-index.spec.ts
index 419549b8ce..1782d11219 100644
--- a/tests/playwright-test/worker-index.spec.ts
+++ b/tests/playwright-test/worker-index.spec.ts
@@ -178,7 +178,7 @@ test('should use new worker after test failure', async ({ runInlineTest }) => {
test('should not reuse worker for different suites', async ({ runInlineTest }) => {
const result = await runInlineTest({
'playwright.config.ts': `
- module.exports = { projects: [{}, {}, {}] };
+ export default { projects: [{}, {}, {}] };
`,
'a.test.js': `
import { test, expect } from '@playwright/test';