-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
40 lines (38 loc) · 989 Bytes
/
jest.config.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
import path from 'path';
import { lstatSync, readdirSync } from 'fs';
// get listing of packages in the mono repo
const basePath = path.resolve(path.dirname(new URL(import.meta.url).pathname), 'packages');
const packages = readdirSync(basePath)
.filter(name => {
return lstatSync(path.join(basePath, name)).isDirectory();
})
.filter(name => name !== "deno");
export default {
preset: 'ts-jest',
testEnvironment: 'node',
transform: {
'\\.ts$': 'ts-jest',
'\\.tsx$': 'ts-jest',
},
moduleNameMapper: {
...packages.reduce(
(acc, name) => ({
...acc,
[`@virtualstate/${name}(.*)$`]:
`<rootDir>/packages/./${name}/src/$1`,
}),
{},
),
},
modulePathIgnorePatterns: [
...packages.reduce(
(acc, name) => [...acc, `<rootDir>/packages/${name}/lib`, `<rootDir>/packages/${name}/node_modules`],
[]
),
],
projects: [
...packages.map(
name => `<rootDir>/packages/${name}`
)
],
};