Skip to content

Commit

Permalink
refactor(preset): explicitly define jsdom for test environment (#621)
Browse files Browse the repository at this point in the history
Jest 27 sets default test environment to `node`. Since we need `jsdom` so we need to explicitly set it in `jest-preset.js`.

Jest 27 will still bundle `jest-environment-jsdom` in the main package and Jest 28 will detach them. However, we should just go ahead and set explicitly `jest-environment-jsdom` in our dependencies list

More information see https://jestjs.io/blog/2020/05/05/jest-26
  • Loading branch information
ahnpnl committed Nov 10, 2020
1 parent 779fd8c commit ef0057f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions jest-preset.js
Expand Up @@ -11,6 +11,7 @@ module.exports = {
},
},
},
testEnvironment: 'jsdom',
transform: {
'^.+\\.(ts|js|html)$': 'ts-jest',
},
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -29,6 +29,7 @@
},
"dependencies": {
"@jest/create-cache-key-function": "^26.5.0",
"jest-environment-jsdom": "^26.6.2",
"pretty-format": "26.x",
"ts-jest": "^26.2.0"
},
Expand Down

0 comments on commit ef0057f

Please sign in to comment.