Skip to content

Commit

Permalink
Upgrade Jest and Webpack
Browse files Browse the repository at this point in the history
Mostly based on changes made in the original NHS app: nhsuk/cookie-consent@ed071c0
  • Loading branch information
jdudley1123 committed Oct 8, 2024
1 parent 1b6af4f commit 65cabfd
Show file tree
Hide file tree
Showing 10 changed files with 15,485 additions and 29,389 deletions.
11 changes: 6 additions & 5 deletions cookie-test-environment.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
const JSDOMEnvironment = require('jest-environment-jsdom');
import JSDOMEnvironment from 'jest-environment-jsdom';

module.exports = class CookieTestEnvironment extends JSDOMEnvironment {
constructor(config) {
super(config);
export default class CookieTestEnvironment extends JSDOMEnvironment {
constructor(config, options) {
super(config, options);
this.global.jsdom = this.dom;
this.global.cookieJar = this.dom.cookieJar;
}

teardown() {
this.global.jsdom = null;
return super.teardown();
}
};
}
8 changes: 3 additions & 5 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ module.exports = {
testEnvironment: './cookie-test-environment.js',
testEnvironmentOptions: {
cookieJar: new jsdom.CookieJar(),
// Set a url with a path so we can write cookie tests that use paths.
url: 'http://localhost/path1/path2/path3/',
},
testMatch: [
'<rootDir>/src/*.test.js',
],
// Set a url with a path so we can write cookie tests that use paths.
testURL: 'http://localhost/path1/path2/path3/',
testMatch: ['<rootDir>/src/*.test.js'],
};
Loading

0 comments on commit 65cabfd

Please sign in to comment.