-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.ts
77 lines (74 loc) · 2.39 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import type { Config } from '@jest/types';
import path from 'path';
const commonModuleNameMapper = {
'react-audio-voice-recorder': path.join(
__dirname,
'__mocks__/react-audio-voice-recorder.ts'
),
'iconify-icon': path.join(__dirname, '__mocks__/iconify.tsx'),
'@langchain/google-genai': path.join(__dirname, '__mocks__/google-genai.ts'),
'@langchain/ollama': path.join(__dirname, '__mocks__/ollama.ts'),
'@langchain/core/runnables': path.join(__dirname, '__mocks__/runnable.ts'),
openai: path.join(__dirname, '__mocks__/openai.ts'),
'^@openassistant/core$': '<rootDir>/packages/core/src/index.ts',
'^@openassistant/geoda$': '<rootDir>/packages/geoda/src/index.ts'
};
const config: Config.InitialOptions = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
rootDir: './',
coverageDirectory: '<rootDir>/coverage',
testPathIgnorePatterns: ['<rootDir>/node_modules'],
extensionsToTreatAsEsm: ['.ts', '.tsx'],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageReporters: ['html', 'json', 'lcov', 'text'],
projects: [
{
displayName: 'core',
moduleDirectories: ['node_modules', 'src'],
testEnvironment: 'jsdom',
transform: {
'^.+\\.ts?$': ['ts-jest', {}],
},
testMatch: ['<rootDir>/packages/core/__tests__/**/*.test.ts'],
testPathIgnorePatterns: ['<rootDir>/packages/core/dist'],
moduleNameMapper: {
...commonModuleNameMapper,
},
setupFiles: [path.join(__dirname, 'jest.setup.ts')],
collectCoverageFrom: [
'<rootDir>/packages/core/**/*.{ts,tsx}',
'!**/*.d.ts',
'!**/node_modules/**',
],
},
{
displayName: 'ui',
testEnvironment: 'jsdom',
transform: {
'^.+\\.(ts|tsx|js|jsx)?$': [
'ts-jest',
{
tsconfig: './packages/ui/tsconfig.json',
},
],
},
testMatch: [
'<rootDir>/packages/ui/__tests__/**/*.test.ts',
'<rootDir>/packages/ui/__tests__/**/*.test.tsx',
],
testPathIgnorePatterns: ['<rootDir>/packages/ui/dist'],
moduleNameMapper: {
...commonModuleNameMapper,
},
setupFiles: [path.join(__dirname, 'jest.setup.ts')],
collectCoverageFrom: [
'<rootDir>/packages/ui/**/*.{ts,tsx}',
'!**/*.d.ts',
'!**/node_modules/**',
],
},
],
moduleDirectories: ['node_modules', 'packages'],
};
export default config;