forked from storybookjs/test-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-runner-jest.config.js
29 lines (26 loc) · 1.13 KB
/
test-runner-jest.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// !!! 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, run test-storybook eject instead
const path = require('path');
// we override the path here so that when running the test-runner locally, it resolves to local files instead when calling require.resolve
process.env.STORYBOOK_TEST_RUNNER_PATH = path.resolve(__dirname);
const { getJestConfig } = require('./dist');
const testRunnerConfig = getJestConfig();
/**
* @type {import('@jest/types').Config.InitialOptions}
*/
module.exports = {
...testRunnerConfig,
cacheDirectory: 'node_modules/.cache/storybook/test-runner',
transform: {
'^.+\\.(story|stories)\\.[jt]sx?$': './playwright/transform',
'^.+\\.[jt]sx?$': '@swc/jest',
},
globalSetup: './playwright/global-setup.js',
globalTeardown: './playwright/global-teardown.js',
testEnvironment: './playwright/custom-environment.js',
setupFilesAfterEnv: ['./playwright/jest-setup.js'],
// use local build when the package is referred
moduleNameMapper: {
'@storybook/test-runner': '<rootDir>/dist/index.js',
},
};