Skip to content

Commit

Permalink
Scripts: Properly use CommonJS for default Playwright config (#54988)
Browse files Browse the repository at this point in the history
* Fix path to `globalSetup` in default Playwright config

Oversight from #54856

* `module.exports`

* Fix default export usage
  • Loading branch information
swissspidy authored Oct 3, 2023
1 parent fd6c166 commit 205f1e3
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions packages/scripts/config/playwright.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const config = defineConfig( {
snapshotPathTemplate:
'{testDir}/{testFileDir}/__snapshots__/{arg}-{projectName}{ext}',
globalSetup: fileURLToPath(
new URL( './playwright/global-setup.ts', 'file:' + __filename ).href
new URL( './playwright/global-setup.js', 'file:' + __filename ).href
),
use: {
baseURL: process.env.WP_BASE_URL || 'http://localhost:8889',
Expand Down Expand Up @@ -60,4 +60,4 @@ const config = defineConfig( {
],
} );

export default config;
module.exports = config;
2 changes: 1 addition & 1 deletion packages/scripts/config/playwright/global-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ async function globalSetup( config ) {
await requestContext.dispose();
}

export default globalSetup;
module.exports = globalSetup;
2 changes: 1 addition & 1 deletion test/e2e/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { defineConfig, devices } from '@playwright/test';
const baseConfig = require( '@wordpress/scripts/config/playwright.config' );

const config = defineConfig( {
...baseConfig.default,
...baseConfig,
reporter: process.env.CI
? [ [ 'github' ], [ './config/flaky-tests-reporter.ts' ] ]
: 'list',
Expand Down
4 changes: 2 additions & 2 deletions test/performance/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const baseConfig = require( '@wordpress/scripts/config/playwright.config' );
process.env.ASSETS_PATH = path.join( __dirname, 'assets' );

const config = defineConfig( {
...baseConfig.default,
...baseConfig,
reporter: process.env.CI
? './config/performance-reporter.ts'
: [ [ 'list' ], [ './config/performance-reporter.ts' ] ],
Expand All @@ -26,7 +26,7 @@ const config = defineConfig( {
new URL( './config/global-setup.ts', 'file:' + __filename ).href
),
use: {
...baseConfig.default.use,
...baseConfig.use,
video: 'off',
},
} );
Expand Down

0 comments on commit 205f1e3

Please sign in to comment.