-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.js
32 lines (29 loc) · 1.04 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
const path = require("path");
const commonModuleNameMappers = {
"\\.module\\.(css|scss)$": "identity-obj-proxy",
"\\.(css|scss)$": require.resolve("./__mocks__/empty_mock.js"),
};
// Not ideal solution, but this doesn't work either. Replace the following on module.exports to test this:
// moduleNameMapper: commonModuleNameMappers -> moduleNameMapper: mockGreeter,
const mockGreeter = {
...commonModuleNameMappers,
...{
"\\.(greeter)$": require.resolve("./__mocks__/empty_mock.js"),
},
};
module.exports = {
rootDir: path.join(__dirname, "./"),
transform: {
"^.+\\.(js|jsx)$": "babel-jest",
},
moduleFileExtensions: ["js", "jsx"],
moduleDirectories: ["node_modules", "js"],
moduleNameMapper: mockGreeter,
resetMocks: true,
setupFilesAfterEnv: ["<rootDir>/test/setupTests.js"],
testEnvironment: "jsdom",
transformIgnorePatterns: ["<rootDir>/node_modules/(?!${greeter})"],
watchPlugins: ["jest-watch-typeahead/filename", "jest-watch-typeahead/testname"],
moduleNameMapper: commonModuleNameMappers,
verbose: true,
};