Skip to content

Commit

Permalink
Update Jest to fix tests after updating ol
Browse files Browse the repository at this point in the history
  • Loading branch information
ZakarFin committed Aug 30, 2024
1 parent cb076c4 commit 0f6cd54
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
11 changes: 4 additions & 7 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@ module.exports = {
'\\.(css|less)$': '<rootDir>/tests/jest/styleMock.js',
'^d3$': '<rootDir>/node_modules/d3/dist/d3.min.js'
},
timers: 'fake',
fakeTimers: {
enableGlobally: true
},
verbose: true,
transformIgnorePatterns: [
'node_modules/(?!(ol|jsts|geotiff|quick-lru)).+\\.js$'
'node_modules/(?!(ol|color-parse|color-space|color-rgba|color-name|jsts|geotiff|quick-lru)).+\\.js$'
]
/*
,transform: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/tests/jest/fileTransformer.js'
}
*/
};
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"license": "(MIT OR EUPL-1.1)",
"main": "grunt.js",
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0",
"node": ">=16.20.0",
"npm": ">=6.0.0"
},
"scripts": {
Expand All @@ -44,6 +44,7 @@
"@testing-library/react": "12.1.5",
"@testing-library/user-event": "14.4.3",
"antd": "4.24.8",
"babel-jest": "29.7.0",
"babel-loader": "8.3.0",
"babel-plugin-styled-components": "2.1.4",
"babel-plugin-transform-remove-strict-mode": "0.0.2",
Expand All @@ -68,7 +69,8 @@
"gm": "1.23.1",
"imports-loader": "0.8.0",
"intl-messageformat": "9.11.4",
"jest": "27.0.6",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"jquery": "3.7.1",
"jsts": "2.2.0",
"less": "3.9.0",
Expand Down
4 changes: 3 additions & 1 deletion tests/jest/fileTransformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const path = require('path');
// to fix static assest from being processed like import 'ol/ol.css';
module.exports = {
process(src, filename, config, options) {
return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';';
return {
code: 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';';
}
}
};

0 comments on commit 0f6cd54

Please sign in to comment.