forked from storybookjs/test-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-runner-jest.config.js
More file actions
33 lines (29 loc) · 1.34 KB
/
Copy pathtest-runner-jest.config.js
File metadata and controls
33 lines (29 loc) · 1.34 KB
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
30
31
32
33
// !!! 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
import path from 'path';
import { fileURLToPath } from 'url';
// we override the path here so that when running the test-runner locally, it resolves to local files instead when calling require.resolve
const __dirname = path.dirname(fileURLToPath(import.meta.url));
process.env.STORYBOOK_TEST_RUNNER_PATH = path.resolve(__dirname);
import { getJestConfig } from './dist/index.js';
const testRunnerConfig = getJestConfig();
/**
* @type {import('@jest/types').Config.InitialOptions}
*/
export default {
...testRunnerConfig,
cacheDirectory: 'node_modules/.cache/storybook/test-runner',
transform: {
'^.+\\.(story|stories)\\.[jt]sx?$': './playwright/transform.js',
'^.+\\.[jt]sx?$': '@swc/jest',
},
globalSetup: './dist/jest-playwright-entries/setup.js',
globalTeardown: './dist/jest-playwright-entries/teardown.js',
testEnvironment: './playwright/custom-environment.js',
setupFilesAfterEnv: ['./playwright/jest-setup.js'],
// transformIgnorePatterns for the storybook package and make sure swc jest ignores it too
// use local build when the package is referred
moduleNameMapper: {
'@storybook/test-runner': '<rootDir>/dist/index.js',
},
};