forked from TanStack/virtual
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.ts
50 lines (45 loc) · 1.25 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: 'virtual-core',
testEnvironment: 'jsdom',
testMatch: ['<rootDir>/packages/virtual-core/**/*.test.[jt]s?(x)'],
setupFilesAfterEnv: [
'<rootDir>/packages/virtual-core/__tests__/jest.setup.js',
],
snapshotFormat: {
printBasicPrototype: false,
},
moduleNameMapper,
},
{
displayName: 'react-virtual',
testEnvironment: 'jsdom',
testMatch: ['<rootDir>/packages/react-virtual/**/*.test.[jt]s?(x)'],
setupFilesAfterEnv: [
'<rootDir>/packages/react-virtual/__tests__/jest.setup.js',
],
snapshotFormat: {
printBasicPrototype: false,
},
moduleNameMapper,
},
],
}