/
jest.config.js
38 lines (35 loc) · 981 Bytes
/
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
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.js',
'^\\./dist/types(\\.js)?$': '<rootDir>/src/types.js',
'^\\./dist/(.+)$': '<rootDir>/src/$1',
'^\\.\\./dist/test-events.js$': '<rootDir>/src/test-events.js'
}
}
module.exports = {
collectCoverageFrom: ['src/**/*.js'],
moduleNameMapper,
testEnvironment: 'node',
testMatch: ['**/tests/**/*.js'],
testPathIgnorePatterns,
transform: { '/(src|tests)/.*\\.js$': 'babel-jest' }
}