-
Notifications
You must be signed in to change notification settings - Fork 31
/
jest.config.js
39 lines (35 loc) · 1.31 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
34
35
36
37
38
39
// eslint-disable-next-line @typescript-eslint/no-require-imports
const env = require('dotenv').config();
const enableJestPreview = env.parsed?.JEST_PREVIEW === 'true';
/** @type {import('ts-jest').JestConfigWithTsJest} */
const config = {
preset: 'ts-jest',
transform: {
'\\.(js|ts|tsx)$': ['ts-jest', { isolatedModules: true }],
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/src/test/jestTools/transformFile.js',
...(enableJestPreview && {
'\\.(s?css|less)$': 'jest-preview/transforms/css',
}),
...(!enableJestPreview && {
'\\.(s?css|less)$': '<rootDir>/src/test/jestTools/transformCss.js',
}),
},
transformIgnorePatterns: ['node_modules/(?!react-leaflet)/'],
reporters: ['default', 'jest-junit'],
moduleDirectories: ['<rootDir>', 'node_modules'],
moduleNameMapper: {
'^src/(.*)$': '<rootDir>/src/$1',
'^schemas/(.*)$': '<rootDir>/schemas/$1',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'json'],
testRegex: '\\.test\\.(ts|tsx|js|jsx)$',
setupFilesAfterEnv: ['<rootDir>/src/setupTests.ts'],
collectCoverageFrom: ['src/**/*.{ts,tsx}'],
testEnvironmentOptions: {
url: 'https://local.altinn.cloud/ttd/test',
},
testEnvironment: 'jsdom',
globalSetup: './src/globalSetup.ts',
};
module.exports = config;