forked from TanStack/query
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest-preset.js
43 lines (39 loc) · 1.03 KB
/
jest-preset.js
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
const path = require('path')
const { lstatSync, readdirSync } = require('fs')
// get listing of packages in the mono repo
const basePath = path.resolve(__dirname, 'packages')
const packages = readdirSync(basePath)
.filter((name) => {
return lstatSync(path.join(basePath, name)).isDirectory()
})
.sort((a, b) => b.length - a.length)
const { namespace } = require('./package.json')
const moduleNameMapper = {
...packages.reduce(
(acc, name) => ({
...acc,
[`${namespace}/${name}(.*)$`]: `<rootDir>/../../packages/./${name}/src/$1`,
}),
{},
),
}
module.exports = {
collectCoverage: true,
coverageReporters: ['json', 'lcov', 'text', 'clover', 'text-summary'],
testMatch: ['<rootDir>/**/src/**/*.test.[jt]s?(x)'],
transform: { '^.+\\.(ts|tsx)$': 'ts-jest' },
clearMocks: true,
testEnvironment: 'jsdom',
snapshotFormat: {
printBasicPrototype: false,
},
globals: {
'ts-jest': {
isolatedModules: true,
diagnostics: {
exclude: ['**'],
},
},
},
moduleNameMapper,
}