-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
38 lines (33 loc) · 1.03 KB
/
jest.config.js
File metadata and controls
38 lines (33 loc) · 1.03 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
34
35
36
37
38
const nextJest = require('next/jest');
const createJestConfig = nextJest({ dir: './' });
/** @type {import('jest').Config} */
const customJestConfig = {
testEnvironment: 'jest-environment-jsdom',
setupFilesAfterEnv: ['<rootDir>/jest.setup.tsx'],
testMatch: ['<rootDir>/**/__tests__/**/*.(test|spec).(ts|tsx)'],
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/$1',
},
// 👇 ignore the CLI package to avoid naming collision
modulePathIgnorePatterns: ['<rootDir>/cli/'],
testPathIgnorePatterns: [
'/node_modules/',
'/.next/',
'/out/',
'/storybook-static/',
'/dist/',
'/build/',
'/cli/', // 👈 keep tests from looking into cli too
],
watchPathIgnorePatterns: ['<rootDir>/cli/'],
collectCoverageFrom: [
'components/**/*.{ts,tsx}',
'!components/**/index.{ts,tsx}',
'!**/*.stories.{ts,tsx}',
],
coverageDirectory: '<rootDir>/coverage',
coverageThreshold: {
global: { statements: 0, branches: 0, functions: 0, lines: 0 },
},
};
module.exports = createJestConfig(customJestConfig);