-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathjest.config.ts
61 lines (60 loc) · 1.6 KB
/
jest.config.ts
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const { Config } = require('@jest/types');
/** @type {import('@jest/types').Config.InitialOptions} */
const config = {
preset: 'ts-jest',
testEnvironment: 'node',
roots: ['<rootDir>/sdk/src', '<rootDir>/cli/src'],
testMatch: [
'**/src/**/__tests__/**/*.[jt]s?(x)',
'**/src/**/?(*.)+(spec|test|tests).[jt]s?(x)'
],
transform: {
'^.+\\.tsx?$': ['ts-jest', {
tsconfig: 'tsconfig.json',
useESM: true,
isolatedModules: true
}],
'^.+\\.jsx?$': ['babel-jest', {
presets: ['@babel/preset-env']
}]
},
transformIgnorePatterns: [
'/node_modules/(?!(crypto-random-string)/)'
],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
'^@glitch-gremlin/sdk$': '<rootDir>/sdk/src/index.ts',
'^@glitch-gremlin/sdk/ai/types$': '<rootDir>/sdk/src/ai/src/types.ts',
'^@security/(.*)$': '<rootDir>/sdk/src/ai/security/$1',
'#cli/(.*)': '<rootDir>/cli/$1',
'^@/(.*)$': '<rootDir>/sdk/src/$1',
'^@ai/(.*)$': '<rootDir>/sdk/src/ai/$1',
},
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node', 'mjs'],
extensionsToTreatAsEsm: ['.ts', '.tsx'],
setupFilesAfterEnv: [
'<rootDir>/jest.setup.ts'
],
testPathIgnorePatterns: [
'/node_modules/',
'/dist/',
'setup\\.ts$',
'jest\\.setup\\.ts$',
'__mocks__'
],
collectCoverage: true,
coverageDirectory: 'coverage',
coveragePathIgnorePatterns: [
'/node_modules/',
'/dist/',
'/__tests__/',
'/__mocks__/'
],
testTimeout: 60000,
verbose: true,
clearMocks: true,
restoreMocks: true,
resetMocks: true,
automock: false
};
module.exports = config;