-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathjest.config.cjs
43 lines (42 loc) · 1.2 KB
/
jest.config.cjs
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
39
40
41
42
43
// ES modules which need to be transformed by babel for use in jest.
const esModules = [
'node-fetch',
'p-throttle',
'p-retry',
'warcio',
// Imported by node-fetch
'fetch-blob',
'data-uri-to-buffer',
'formdata-polyfill',
// Imported by p-retry
'is-network-error',
// Imported by warcio
'to-data-view',
'base32-encode',
].join('|');
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
testEnvironment: './tests/unit/utils/extended-jsdom-environment.ts',
moduleNameMapper: {
'^@lib/(.*)$': '<rootDir>/src/lib/$1',
'^@test-utils/(.*)$': '<rootDir>/tests/unit/utils/$1',
'^@src/(.*)$': '<rootDir>/src/$1',
},
setupFilesAfterEnv: [
'jest-extended/all',
'./tests/unit/utils/setup-gm-mocks.ts',
],
collectCoverageFrom: [
'src/**/*.{js,ts}',
'!**/meta.ts',
],
transformIgnorePatterns: [
// Don't transform any module in `node_modules`, except for the ES
// modules. We need to transform ESM because jest expects CJS.
`/node_modules/(?!${esModules})`,
],
reporters: [
'default',
'jest-html-reporters',
],
};