-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjest.config.js
36 lines (33 loc) · 1.11 KB
/
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
const { fromPairs, map, pathOr, pipe, toPairs } = require("ramda");
const gatsbyConfig = require("./gatsby-config");
const gatsbyConfigAliases = pipe(
pathOr([], ["plugins", 1, "options", "alias"]),
toPairs,
map(([k, v]) => ["^" + k + "/" + "(.*)$", "<rootDir>/" + v + "/$1"]),
fromPairs
)(gatsbyConfig);
module.exports = {
displayName: "test",
transform: {
"^.+\\.js?$": `<rootDir>/jest-preprocess.js`
},
moduleNameMapper: Object.assign(
{},
{
"^./pages.json$": "<rootDir>/__mocks__/pages.json",
".+\\.(css|styl|less|sass|scss)$": `identity-obj-proxy`,
".+\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": `<rootDir>/__mocks__/file-mock.js`,
".+\\.svg$": `<rootDir>/__mocks__/svg-mock.js`
},
gatsbyConfigAliases
),
testPathIgnorePatterns: [`node_modules`, `.cache`],
coveragePathIgnorePatterns: ["index.js"],
transformIgnorePatterns: [`node_modules/(?!(gatsby)/)`],
globals: {
__PATH_PREFIX__: ``
},
testURL: `http://localhost`,
setupFiles: [`<rootDir>/loadershim.js`],
setupFilesAfterEnv: ["<rootDir>/jest-global.js"]
};