Skip to content

Commit

Permalink
support PW 1.42 onwards
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed May 28, 2024
1 parent f0970e1 commit 0283f4f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/config/playwright.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ import {
export const defineConfig = (config: PlaywrightTestConfig) => {
const { STORYBOOK_STORIES_PATTERN } = process.env;

// @ts-ignore use _contextReuseMode
return playwrightDefineConfig({
const original = playwrightDefineConfig({
testDir: process.env.TEST_ROOT || process.cwd(),
testMatch: STORYBOOK_STORIES_PATTERN?.split(';'),
globalSetup: path.join(__dirname, 'config', 'global.setup.js'),
Expand Down Expand Up @@ -56,6 +55,7 @@ export const defineConfig = (config: PlaywrightTestConfig) => {
},
],

// Keep this for older versions of PW if we ever need. It stopped working in 1.42.0
build: {
babelPlugins: [[path.join(__dirname, 'playwright', 'csf-playwright-plugin.js')]],
// @ts-ignore
Expand All @@ -71,4 +71,12 @@ export const defineConfig = (config: PlaywrightTestConfig) => {
},
...config,
});

return {
...original,
'@playwright/test': {
...(original as any)['@playwright/test'],
babelPlugins: [[path.join(__dirname, 'playwright', 'csf-playwright-plugin.js')]],
},
} as PlaywrightTestConfig;
};

0 comments on commit 0283f4f

Please sign in to comment.