forked from grafana/pyroscope
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
33 lines (28 loc) · 1.26 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
const path = require('path');
const { pathsToModuleNameMapper } = require('ts-jest');
const { compilerOptions } = require('./tsconfig');
module.exports = {
// TypeScript files (.ts, .tsx) will be transformed by ts-jest to CommonJS syntax, and JavaScript files (.js, jsx) will be transformed by babel-jest.
testEnvironment: 'jsdom',
testMatch: ['**/?(*.)+(spec|test).+(ts|tsx|js)'],
transform: {
'\\.module\\.(css|scss)$': 'jest-css-modules-transform',
'\\.(css|scss)$': 'jest-css-modules-transform',
'\\.svg$': path.join(__dirname, 'svg-transform.js'),
'^.+\\.(t|j)sx?$': ['@swc/jest'],
},
transformIgnorePatterns: [
// force us to transpile these dependencies
// https://stackoverflow.com/a/69150188
'node_modules/(?!(true-myth|d3|d3-array|internmap|d3-scale|react-notifications-component|graphviz-react|@react-hook))',
],
testPathIgnorePatterns: ['/node_modules/', '/og/'],
// Reuse the same modules from typescript
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
prefix: '<rootDir>',
'@phlare/(.*)$': path.join(__dirname, 'public/app/$1'),
}),
globalSetup: '<rootDir>/globalSetup.js',
globalTeardown: '<rootDir>/globalTeardown.js',
setupFilesAfterEnv: [path.join(__dirname, 'setupAfterEnv.ts')],
};