-
-
Notifications
You must be signed in to change notification settings - Fork 65
/
jest.config.ts
50 lines (45 loc) · 1.23 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
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()
})
const { namespace } = require('./package.json')
const moduleNameMapper = {
...packages.reduce(
(acc, name) => ({
...acc,
[`${namespace}/${name}(.*)$`]: `<rootDir>/packages/./${name}/src/$1`,
}),
{},
),
}
module.exports = {
projects: [
{
displayName: 'ranger',
testEnvironment: 'jsdom',
testMatch: ['<rootDir>/packages/ranger/**/*.test.[jt]s?(x)'],
setupFilesAfterEnv: [
'<rootDir>/packages/ranger-core/__tests__/jest.setup.js',
],
snapshotFormat: {
printBasicPrototype: false,
},
moduleNameMapper,
},
{
displayName: 'react-ranger',
testEnvironment: 'jsdom',
testMatch: ['<rootDir>/packages/react-ranger/**/*.test.[jt]s?(x)'],
setupFilesAfterEnv: [
'<rootDir>/packages/react-ranger/__tests__/jest.setup.js',
],
snapshotFormat: {
printBasicPrototype: false,
},
moduleNameMapper,
},
],
}