forked from BigFatDog/cubism-es
-
Notifications
You must be signed in to change notification settings - Fork 1
/
jest.config.ts
51 lines (49 loc) · 1.39 KB
/
jest.config.ts
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
44
45
46
47
48
49
50
51
const path = require('path');
const nodeModulesToTransform = (moduleNames: string[]) =>
`node_modules\/(?!.*(${moduleNames.join('|')})\/.*)`;
// Array of known package dependencies that only bundle an ESM version
const ESModules = [
'.pnpm', // Support using pnpm symlinked packages
'd3',
'd3-.*',
'internmap',
'delaunator',
'robust-predicates',
'rxjs',
'uuid',
];
module.exports = {
modulePaths: ['./src'],
setupFiles: ['jest-canvas-mock'],
setupFilesAfterEnv: ['./jest-setup.js'],
testEnvironment: 'jest-environment-jsdom',
testMatch: ['<rootDir>/src/tests/*.{test,jest}.{js,ts}'],
coverageDirectory: 'coverage/jest',
testEnvironmentOptions: {
url: 'https://localhost/?mockedQueryString=true&Another=2',
},
watchPathIgnorePatterns: [
'/node_modules/', // Ignore changes in node_modules directory
'/dist/', // Ignore changes in the dist directory
'/coverage/',
],
// Jest will throw `Cannot use import statement outside module` if it tries to load an
// ES module without it being transformed first.
transformIgnorePatterns: [nodeModulesToTransform(ESModules)],
transform: {
'^.+\\.(t|j)sx?$': [
'@swc/jest',
{
sourceMaps: 'inline',
jsc: {
parser: {
syntax: 'typescript',
tsx: true,
decorators: false,
dynamicImport: true,
},
},
},
],
},
};