forked from intershop/intershop-pwa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
41 lines (38 loc) · 1.67 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
40
41
const fs = require('fs');
const { pathsToModuleNameMapper } = require('ts-jest');
const tsConfig = require('comment-json').parse(fs.readFileSync('./tsconfig.json', { encoding: 'utf-8' }));
const esModules = ['lodash-es/.*', 'swiper', 'ssr-window', 'dom7', '.*\\.mjs$'];
const { defaultTransformerOptions } = require('jest-preset-angular/presets');
/** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
module.exports = {
transform: {
'^.+\\.(ts|js|mjs|html|svg)$': [
'jest-preset-angular',
{
...defaultTransformerOptions,
isolatedModules: true,
},
],
},
preset: 'jest-preset-angular',
testRunner: 'jest-jasmine2',
maxWorkers: process.env.JEST_MAX_WORKERS || '75%', // keep some cpu for moving the mouse
roots: ['src', 'projects'],
setupFilesAfterEnv: ['<rootDir>/src/setupJest.ts'],
globalSetup: 'jest-preset-angular/global-setup',
transformIgnorePatterns: [`node_modules/(?!${esModules.join('|')})`],
moduleNameMapper: {
...pathsToModuleNameMapper(tsConfig.compilerOptions.paths, { prefix: '<rootDir>' }),
// This forces jest to use a Node+CommonJS version of uuid. Refer to the following resources for more info:
// https://github.com/uuidjs/uuid/pull/616
// https://github.com/microsoft/accessibility-insights-web/pull/5421#issuecomment-1109168149
'^uuid$': require.resolve('uuid'),
},
snapshotSerializers: [
'./src/jest-serializer/AngularHTMLSerializer.js',
'./src/jest-serializer/CategoryTreeSerializer.js',
'./src/jest-serializer/NgrxActionSerializer.js',
'./src/jest-serializer/NgrxActionArraySerializer.js',
],
dependencyExtractor: '<rootDir>/jest.dependency-extractor.js',
};