Skip to content

Commit

Permalink
Merge pull request #1544 from sul-dlss/fix-jest-tests
Browse files Browse the repository at this point in the history
Fix JS testing with Jest
  • Loading branch information
jcoyne authored Oct 17, 2023
2 parents 1ef533c + 1090763 commit 5445b38
Show file tree
Hide file tree
Showing 4 changed files with 1,513 additions and 41 deletions.
1 change: 1 addition & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ module.exports = async () => {
'<rootDir>/spec/javascripts/common_viewer/**/*.js',
'<rootDir>/spec/javascripts/geo/**/*.js',
],
testEnvironment: 'jsdom',
};
};
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@
"babel-loader": "8",
"babel-plugin-macros": "^3.1.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"canvas": "^2.9.1",
"canvas": "^2.11.2",
"compression-webpack-plugin": "9",
"fscreen": "^1.0.2",
"handlebars": "^4.7.7",
"handlebars-loader": "^1.7.3",
"jquery": "^3.7.1",
"leaflet": "^1.9.3",
"mirador": "^3.3.0",
"mirador-dl-plugin": "^0.13.0",
Expand Down Expand Up @@ -65,6 +66,8 @@
],
"devDependencies": {
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"react-refresh": "^0.14.0"
}
}
2 changes: 1 addition & 1 deletion setupJest.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import $ from 'jquery';
import * as L from 'leaflet-src.js.erb';
import * as L from 'leaflet';

// make jQuery globally available in tests as both "$" and "jQuery"
global.jQuery = $;
Expand Down
Loading

0 comments on commit 5445b38

Please sign in to comment.