-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathjest.config.mjs
65 lines (61 loc) · 1.67 KB
/
jest.config.mjs
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
import { tsMonorepoConfig } from '@guanghechen/jest-config'
import path from 'node:path'
import url from 'node:url'
export default async function () {
const __dirname = path.dirname(url.fileURLToPath(import.meta.url))
const { default: manifest } = await import(path.resolve('package.json'), {
assert: { type: 'json' },
})
const baseConfig = await tsMonorepoConfig(__dirname, {
useESM: true,
tsconfigFilepath: path.join(__dirname, 'tsconfig.test.json'),
})
const config = {
...baseConfig,
coveragePathIgnorePatterns: [
...(baseConfig.coveragePathIgnorePatterns || []),
'<rootDir>/src/dev.ts',
],
coverageThreshold: {
...coverageMap[manifest.name],
global: {
branches: 100,
functions: 100,
lines: 100,
statements: 100,
...coverageMap[manifest.name]?.global,
},
},
extensionsToTreatAsEsm: ['.ts', '.mts'],
}
return config
}
const coverageMap = {
'@algorithm.ts/bipartite-matching': {
global: { functions: 87, lines: 95, statements: 95 },
},
'@algorithm.ts/calculator': {
global: { branches: 97, lines: 98, statements: 98 },
},
'@algorithm.ts/graph': {
global: { functions: 75, lines: 82, statements: 82 },
},
'@algorithm.ts/gomoku': {
global: { branches: 92, lines: 99, statements: 99 },
},
'@algorithm.ts/lcs': {
global: { branches: 95, lines: 97, statements: 97 },
},
'@algorithm.ts/kth': {
global: { branches: 98 },
},
'@algorithm.ts/shuffle': {
global: { branches: 88 },
},
'@algorithm.ts/sort': {
global: { branches: 99 },
},
'@algorithm.ts/sudoku': {
global: { branches: 96, lines: 99, statements: 99 },
},
}