-
Notifications
You must be signed in to change notification settings - Fork 66
/
jest.config.js
25 lines (21 loc) · 985 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
const tfmConfig = require('@theforeman/test/src/pluginConfig');
// Find where foreman is located
const { foremanRelativePath, foremanLocation } = require('@theforeman/find-foreman');
const foremanReactRelative = 'webpack/assets/javascripts/react_app';
const foremanFull = foremanLocation();
const foremanReactFull = foremanRelativePath(foremanReactRelative);
// Makes svg files work in tests
tfmConfig.transform["^.+\\.svg$"] = "jest-svg-transformer";
// Makes graphql files work in test
tfmConfig.transform["\\.(gql|graphql)$"] = "jest-transform-graphql";
// Find correct path to foremanReact so we do not have to mock it in tests
tfmConfig.moduleNameMapper['^foremanReact(.*)$'] = `${foremanReactFull}/$1`;
// Do not use default resolver
tfmConfig.resolver = null;
// Specify module dirs instead
tfmConfig.moduleDirectories = [
`${foremanFull}/node_modules`,
`${foremanFull}/node_modules/@theforeman/vendor-core/node_modules`,
'node_modules',
]
module.exports = tfmConfig;