Skip to content

Commit

Permalink
Merge pull request #25 from storybookjs/fix/move-config-location
Browse files Browse the repository at this point in the history
fix: move test-runner default configuration location and resolution
  • Loading branch information
shilman authored Jan 12, 2022
2 parents baa1f80 + e62f9ee commit 79a2d6a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/test-storybook.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
13 changes: 13 additions & 0 deletions playwright/test-runner-jest.config.js
Original file line number Diff line number Diff line change
@@ -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',
};
10 changes: 6 additions & 4 deletions test-runner-jest.config.js
Original file line number Diff line number Diff line change
@@ -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',
};

0 comments on commit 79a2d6a

Please sign in to comment.