Skip to content

Commit

Permalink
Preparing upgrade to jest v28. (#1057)
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisoelkers authored Jun 29, 2022
1 parent c058de3 commit 86a83f5
Show file tree
Hide file tree
Showing 3 changed files with 1,129 additions and 1,047 deletions.
29 changes: 20 additions & 9 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,35 @@
* along with this program. If not, see
* <http://www.mongodb.com/licensing/server-side-public-license>.
*/
const fs = require('fs');
const buildConfig = require('./build.config');

const packageJson = JSON.parse(fs.readFileSync('package.json'));
const webSrcPrefix = buildConfig.web_src_path;
const {
moduleDirectories,
moduleNameMapper
} = packageJson.jest;

const jestConfig = {
...packageJson.jest,
moduleDirectories: [].concat(moduleDirectories, [`${webSrcPrefix}/src`, `${webSrcPrefix}/test`]),
preset: 'jest-preset-graylog',
setupFiles: [],
setupFilesAfterEnv: [
'jest-enzyme',
],
moduleDirectories: [
'src',
'test',
'node_modules',
`${webSrcPrefix}/src`,
`${webSrcPrefix}/test`,
],
moduleNameMapper: {
...moduleNameMapper,
'^aws/(.+)$': 'web/aws/$1',

'^react$': `${webSrcPrefix}/node_modules/react/index.js`,
'^react-dom$': `${webSrcPrefix}/node_modules/react-dom/index.js`,
'^styled-components$': `${webSrcPrefix}/node_modules/styled-components`,
},
roots: [
'src',
],
transform: {
'^.+\\.[tj]sx?$': 'babel-jest',
},
};
module.exports = jestConfig;
18 changes: 0 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,6 @@
"stylelint": {
"extends": "stylelint-config-graylog"
},
"jest": {
"preset": "jest-preset-graylog",
"setupFiles": [],
"moduleDirectories": [
"src",
"src/test",
"node_modules"
],
"moduleNameMapper": {
"^aws/(.+)$": "web/aws/$1"
},
"roots": [
"src"
],
"transform": {
"^.+\\.[tj]sx?$": "babel-jest"
}
},
"keywords": [
"graylog"
],
Expand Down
Loading

0 comments on commit 86a83f5

Please sign in to comment.