-
Notifications
You must be signed in to change notification settings - Fork 8
/
jest.config.base.js
34 lines (31 loc) · 978 Bytes
/
jest.config.base.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
34
'use strict';
const path = require('path');
/** @typedef {import('ts-jest')} */
/** @type {import('@jest/types').Config.InitialOptions} */
const config = {
preset: 'ts-jest/presets/js-with-babel',
testEnvironment: 'jsdom',
testEnvironmentOptions: {
url: 'http://localhost/'
},
setupFilesAfterEnv: [path.resolve(__dirname, '.jest', 'setupAfterEnv.js')],
moduleNameMapper: {
'\\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': path.resolve(__dirname, '.jest', 'mocks', 'file.js'),
'\\.(css|scss|sass|less)$': path.resolve(__dirname, '.jest', 'mocks', 'style.js')
},
moduleDirectories: [
'node_modules'
],
transform: {
"^.+\\.jsx?$": 'babel-jest',
"^.+\\.tsx?$": ['ts-jest', {
isolatedModules: true,
tsconfig: path.resolve(__dirname, 'tsconfig.jest.json'),
useESM: false
}]
},
transformIgnorePatterns: [
'node_modules/\.pnpm/(?!@)'
],
};
module.exports = config;