/
jest.config.js
39 lines (36 loc) · 1.03 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
let moduleNameMapper
const testPathIgnorePatterns = ['tests/_import', 'cst/common']
// The npm script name is significant.
switch (process.env.npm_lifecycle_event) {
case 'test:dist':
moduleNameMapper = {}
testPathIgnorePatterns.push(
'cst/Node',
'cst/set-value',
'cst/source-utils',
'cst/YAML-1.2',
'doc/createNode',
'doc/errors',
'doc/foldFlowLines',
'doc/types'
)
break
case 'test':
default:
process.env.TRACE_LEVEL = 'log'
moduleNameMapper = {
'^\\./dist$': '<rootDir>/src/index.ts',
'^\\./dist/types(\\.js)?$': '<rootDir>/src/types.ts',
'^\\./dist/(.+)$': '<rootDir>/src/$1',
'^\\.\\./dist/test-events.js$': '<rootDir>/src/test-events.ts'
}
}
module.exports = {
collectCoverageFrom: ['src/**/*.{js,ts}', '!src/**/*.d.ts'],
moduleNameMapper,
resolver: 'jest-ts-webcompat-resolver',
testEnvironment: 'node',
testMatch: ['**/tests/**/*.{js,ts}'],
testPathIgnorePatterns,
transform: { '/(src|tests)/.*\\.(js|ts)$': 'babel-jest' }
}