diff --git a/bin/test-storybook.js b/bin/test-storybook.js index 06bc18ac..3d9f8909 100644 --- a/bin/test-storybook.js +++ b/bin/test-storybook.js @@ -54,7 +54,7 @@ function executeJestPlaywright() { const jestConfigPath = fs.existsSync('test-runner-jest.config.js') ? 'test-runner-jest.config.js' - : path.resolve(__dirname, '../test-runner-jest.config.js') + : path.resolve(__dirname, '../playwright/test-runner-jest.config.js') argv.push( '--config', diff --git a/playwright/test-runner-jest.config.js b/playwright/test-runner-jest.config.js new file mode 100644 index 00000000..48420c8d --- /dev/null +++ b/playwright/test-runner-jest.config.js @@ -0,0 +1,13 @@ +module.exports = { + cacheDirectory: 'node_modules/.cache/storybook/test-runner', + rootDir: process.cwd(), + testMatch: ['**/*.stories.[jt]s?(x)'], + transform: { + '^.+\\.stories\\.[jt]sx?$': '@storybook/test-runner/playwright/transform', + '^.+\\.[jt]sx?$': 'babel-jest', + }, + preset: 'jest-playwright-preset', + globalSetup: '@storybook/test-runner/playwright/global-setup.js', + globalTeardown: '@storybook/test-runner/playwright/global-teardown.js', + testEnvironment: '@storybook/test-runner/playwright/custom-environment.js', +}; diff --git a/test-runner-jest.config.js b/test-runner-jest.config.js index 48420c8d..4a0486b9 100644 --- a/test-runner-jest.config.js +++ b/test-runner-jest.config.js @@ -1,13 +1,15 @@ +// !!! This file is used as an override to the test-runner configuration for this repo only !!! +// If you want to create your own override for your project, use playwright/test-runner-jest.config.js as base instead module.exports = { cacheDirectory: 'node_modules/.cache/storybook/test-runner', rootDir: process.cwd(), testMatch: ['**/*.stories.[jt]s?(x)'], transform: { - '^.+\\.stories\\.[jt]sx?$': '@storybook/test-runner/playwright/transform', + '^.+\\.stories\\.[jt]sx?$': './playwright/transform', '^.+\\.[jt]sx?$': 'babel-jest', }, preset: 'jest-playwright-preset', - globalSetup: '@storybook/test-runner/playwright/global-setup.js', - globalTeardown: '@storybook/test-runner/playwright/global-teardown.js', - testEnvironment: '@storybook/test-runner/playwright/custom-environment.js', + globalSetup: './playwright/global-setup.js', + globalTeardown: './playwright/global-teardown.js', + testEnvironment: './playwright/custom-environment.js', };