forked from TanStack/query
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.ts
38 lines (34 loc) · 1013 Bytes
/
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
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'],
projects: packages.map((d) => ({
displayName: d,
clearMocks: true,
testEnvironment: 'jsdom',
testMatch: [`<rootDir>/packages/${d}/**/*.test.[jt]s?(x)`],
setupFilesAfterEnv: [`<rootDir>/jest.setup.js`],
snapshotFormat: {
printBasicPrototype: false,
},
moduleNameMapper,
})),
}