-
-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathjest.config.ts
More file actions
29 lines (26 loc) · 775 Bytes
/
jest.config.ts
File metadata and controls
29 lines (26 loc) · 775 Bytes
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
import nextJest from 'next/jest';
const createJestConfig = nextJest({
dir: './',
});
const esModules = ['otpauth'];
const config = {
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
moduleNameMapper: {
'^@/components/(.*)$': '<rootDir>/components/$1',
'^@/pages/(.*)$': '<rootDir>/pages/$1',
},
testEnvironment: 'jest-environment-jsdom',
transformIgnorePatterns: [
`/node_modules/(?!(${esModules.join('|')})/)`,
],
};
// See https://github.com/vercel/next.js/issues/40183#issuecomment-1249077718
export default async () => {
const jestConfig = await createJestConfig(config)();
return {
...jestConfig,
transformIgnorePatterns: jestConfig.transformIgnorePatterns.filter(
(ptn: string) => ptn !== '/node_modules/',
),
};
};