-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathjest.unit.config.js
More file actions
44 lines (44 loc) · 1.28 KB
/
Copy pathjest.unit.config.js
File metadata and controls
44 lines (44 loc) · 1.28 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
43
44
/** @type {import('jest').Config} */
export default {
preset: 'ts-jest',
extensionsToTreatAsEsm: ['.ts', '.tsx'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
// Mock ink and ink-testing-library to avoid ESM issues in unit/integration tests
'^ink$': '<rootDir>/tests/__mocks__/ink.js',
'^ink-testing-library$': '<rootDir>/tests/__mocks__/ink-testing-library.js',
'^ink-syntax-highlight$': '<rootDir>/tests/__mocks__/ink-syntax-highlight.js',
'^@inkjs/ui$': '<rootDir>/tests/__mocks__/@inkjs/ui.js'
},
transformIgnorePatterns: [
'node_modules/(?!(ink|ink-testing-library|ink-syntax-highlight|marked)/)'
],
transform: {
'^.+\\.tsx?$': ['ts-jest', {
useESM: true,
tsconfig: {
module: 'ES2022',
target: 'ES2022'
}
}],
'^.+\\.jsx?$': ['babel-jest', {
presets: [['@babel/preset-env', {targets: {node: 'current'}}]]
}]
},
testEnvironment: 'node',
setupFilesAfterEnv: ['<rootDir>/tests/setup.ts'],
testMatch: [
'<rootDir>/tests/unit/**/*.test.{ts,tsx}',
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!src/**/*.d.ts',
],
fakeTimers: {
enableGlobally: true,
advanceTimers: true,
},
clearMocks: true,
resetMocks: true
};