-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathjest.config.mjs
More file actions
42 lines (38 loc) · 1.03 KB
/
jest.config.mjs
File metadata and controls
42 lines (38 loc) · 1.03 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
40
41
42
import { createDefaultEsmPreset } from 'ts-jest'
const presetConfig = createDefaultEsmPreset({
tsconfig: './tsconfig.test.json'
})
// Module name mapper to resolve .js imports to .ts files for ESM support
const moduleNameMapper = {
'^(\\.{1,2}/.*)\\.js$': '$1'
}
/** @type {import('jest').Config} */
const config = {
...presetConfig,
verbose: true,
clearMocks: true,
testEnvironment: 'node',
moduleFileExtensions: ['js', 'ts'],
projects: [
{
displayName: 'unit-tests',
testEnvironment: 'node',
testMatch: ['**/*.test.ts'],
testPathIgnorePatterns: ['main.test.ts', '/node_modules/', '/dist/'],
moduleNameMapper,
...presetConfig
},
{
displayName: 'main-test',
testEnvironment: 'node',
testMatch: ['**/main.test.ts'],
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
moduleNameMapper,
...presetConfig
}
],
coverageReporters: ['json-summary', 'text', 'lcov'],
collectCoverage: true,
collectCoverageFrom: ['./src/**']
}
export default config