-
Notifications
You must be signed in to change notification settings - Fork 8
/
jest-preset.js
38 lines (37 loc) · 1.3 KB
/
jest-preset.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
const { jsWithTs: tsjPreset } = require('ts-jest/presets');
module.exports = {
// use ts-jest to transform all test files so they are fully typed checked
transform: tsjPreset.transform,
testEnvironment: 'jsdom',
verbose: true,
// automatically clear mock calls and instances before every test,
// equivalent to calling jest.clearAllMocks() before each test
clearMocks: true,
testPathIgnorePatterns: [
'<rootDir>/node_modules/',
'<rootDir>/dist/',
'<rootDir>/coverage/',
'<rootDir>/demo/',
],
collectCoverage: true,
// coverage reporter 'text' outputs the coverage to the command line,
// while 'lcov' generates an lcov report in the coverage directory
coverageReporters: ['text', 'lcov'],
// so the coverage report includes all files, including untested files
collectCoverageFrom: ['<rootDir>/src/**.*'],
// adds type ahead capability when filtering tests in watch mode
// see https://github.com/jest-community/jest-watch-typeahead
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
globals: {
'ts-jest': {
diagnostics: {
// TS151001 is a suggestion to set esModuleInterop to true
// regardless of if it is actually causing an issue, so not useful
ignoreCodes: [151001],
},
},
},
};