Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16947 from webpack/chore-jest
Update Jest to v29 and fix bugs with Jest not working past node 16
- Loading branch information
Showing
8 changed files
with
624 additions
and
795 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module.exports = [ | ||
[{ moduleName: /data.poison/, message: /Unexpected token .+ in JSON/ }] | ||
[{ moduleName: /data.poison/, message: /Unexpected token .+ JSON/ }] | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const NodeEnvironment = | ||
// For jest@29 | ||
require("jest-environment-node").TestEnvironment || | ||
// For jest@27 | ||
require("jest-environment-node"); | ||
|
||
class CustomEnvironment extends NodeEnvironment { | ||
constructor(config, context) { | ||
super(config, context); | ||
} | ||
|
||
// Workaround for `Symbol('JEST_STATE_SYMBOL')` | ||
async handleTestEvent(event, state) { | ||
if (!this.global["JEST_STATE_SYMBOL"]) { | ||
this.global["JEST_STATE_SYMBOL"] = state; | ||
} | ||
} | ||
} | ||
|
||
module.exports = CustomEnvironment; |
Oops, something went wrong.