forked from n8n-io/n8n
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
39 lines (33 loc) · 1.22 KB
/
jest.config.js
File metadata and controls
39 lines (33 loc) · 1.22 KB
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
const { pathsToModuleNameMapper } = require('ts-jest')
const { compilerOptions } = require('get-tsconfig').getTsconfig().config;
/** @type {import('ts-jest').TsJestGlobalOptions} */
const tsJestOptions = {
isolatedModules: true,
tsconfig: {
...compilerOptions,
declaration: false,
sourceMap: true,
},
};
const isCoverageEnabled = process.env.COVERAGE_ENABLED === 'true';
/** @type {import('jest').Config} */
const config = {
verbose: true,
testEnvironment: 'node',
testRegex: '\\.(test|spec)\\.(js|ts)$',
testPathIgnorePatterns: ['/dist/', '/node_modules/'],
transform: {
'^.+\\.ts$': ['ts-jest', tsJestOptions],
},
// This resolve the path mappings from the tsconfig relative to each jest.config.js
moduleNameMapper: compilerOptions?.paths ? pathsToModuleNameMapper(compilerOptions.paths, { prefix: `<rootDir>${compilerOptions.baseUrl ? `/${compilerOptions.baseUrl.replace(/^\.\//, '')}` : ''}` }) : {},
setupFilesAfterEnv: ['jest-expect-message'],
collectCoverage: isCoverageEnabled,
coverageReporters: ['text-summary', 'lcov', 'html-spa'],
collectCoverageFrom: ['src/**/*.ts'],
workerIdleMemoryLimit: '1MB',
};
if (process.env.CI === 'true') {
config.coverageReporters = ['cobertura'];
}
module.exports = config;