forked from ROpdebee/mb-userscripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.cjs
30 lines (29 loc) · 1.06 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
// ES modules which need to be transformed by babel for use in jest.
const esModules = ['node-fetch', 'fetch-blob', 'p-throttle', 'p-retry', 'warcio', 'data-uri-to-buffer', 'formdata-polyfill'].join('|');
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
testEnvironment: 'setup-polly-jest/jest-environment-jsdom',
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',
'./tests/unit/utils/fix-jsdom-env.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',
],
};