-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathjest.config.js
38 lines (34 loc) · 1.25 KB
/
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
37
38
const nextJest = require('next/jest')
const createJestConfig = nextJest({ dir: './' })
async function jestConfig() {
const nextJestConfig = await createJestConfig({
collectCoverageFrom: [
'src/**/*.{js,jsx,ts,tsx}',
'!src/**/__tests__/*.{js,jsx,ts,tsx}',
'!src/mocks/**',
// Ignoring these files as of https://github.com/vercel/next.js/issues/47299
'!src/**/**/layout.tsx',
'!src/**/**/route.ts',
'!src/**/**/page.tsx',
'!src/app/home/index.tsx',
'!src/**/**/not-found.tsx',
'!src/**/**/providers.tsx',
'!src/**/**/opengraph-image.tsx',
'!src/mdx-components.tsx',
'!src/utils/api/blog/index.ts',
'!src/app/blog/[slug]/components/Playground/index.tsx',
'!src/app/blog/[slug]/components/SandpackCSS/index.tsx',
],
testMatch: ['**/*.(spec).(js)', '**/*.(spec).(ts)', '**/*.(spec).(tsx)'],
moduleNameMapper: {
'src/(.*)$': '<rootDir>/src/$1',
// For some reason Jest is not able to resolve `rehype-pretty-code`
// when running tests
'rehype-pretty-code': '<rootDir>/node_modules/rehype-pretty-code',
},
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
})()
return nextJestConfig
}
module.exports = jestConfig