-
-
Notifications
You must be signed in to change notification settings - Fork 572
/
jest.config.base.js
44 lines (41 loc) · 1.48 KB
/
jest.config.base.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
44
if (!("GRAPHILE_ENV" in process.env)) {
process.env.GRAPHILE_ENV = "test";
}
module.exports = (dir) => {
const packageJson = require(`${dir}/package.json`);
return {
testEnvironment: "node",
transform: {
"^.+\\.jsx?$": `${__dirname}/.jest-babel-transform.js`,
"^.+\\.tsx?$": `${__dirname}/.jest-babel-transform.js`,
},
testMatch: ["<rootDir>/**/__tests__/**/*.test.[jt]s?(x)"],
moduleFileExtensions: ["js", "json", "jsx", "ts", "tsx", "node"],
roots: [`<rootDir>`],
snapshotSerializers: [
`${__dirname}/utils/jest-serializer-graphql-schema`,
`${__dirname}/utils/jest-serializer-simple`,
],
extensionsToTreatAsEsm: [".ts"],
moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1",
},
rootDir: dir,
// name: packageJson.name,
displayName: packageJson.name,
globals: {
/*
"ts-jest": {
// Ref: https://github.com/votingworks/ballot-encoder/pull/13/files/b5bbb770c1cc0777c0aee1455b61497afd46cccd#r381505804
// ts-jest assumes it can walk up from its location on disk to find
// package.json, but this is not true when operating in the yarn PnP
// virtual file system. Instead, we provide it directly.
packageJson,
},
*/
},
setupFiles: [`${__dirname}/__tests__/setup-mock-fs.ts`],
// Jest doesn't currently support prettier v3; see https://github.com/jestjs/jest/issues/14305
prettierPath: require.resolve("@localrepo/prettier2-for-jest"),
};
};