-
Notifications
You must be signed in to change notification settings - Fork 5
/
jest.config.js
36 lines (31 loc) · 986 Bytes
/
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
30
31
32
33
34
35
36
const { argv } = process;
const basicConfig = {
coveragePathIgnorePatterns: [".story.js", "lib/*"],
setupFiles: [
"./.storybook/jest/require.context.js",
"<rootDir>/node_modules/regenerator-runtime/runtime",
// ⬆️ for async/await tests to work in jest 22
// Ref.: https://github.com/facebook/jest/issues/5698
],
setupFilesAfterEnv: ["<rootDir>/jest.testFramework.js"],
moduleNameMapper: {
"\\.(css|jpg|png|svg)$": "<rootDir>/empty-module.js",
},
testEnvironment: "jest-environment-jsdom-global",
};
const completeConfig = {
...basicConfig,
verbose: true,
transform: {
"^.+\\.[tj]sx?$": "babel-jest",
"^.+\\.mdx$": "@storybook/addon-docs/jest-transform-mdx",
},
};
const fastConfig = {
...basicConfig,
verbose: false,
onlyChanged: true,
testPathIgnorePatterns: ["Storyshots.test.js"],
};
const useComplete = argv.includes("-u") || argv.includes("--coverage");
module.exports = useComplete ? completeConfig : fastConfig;