-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: fix jest environment missing structuredClone (#2185)
- Loading branch information
Showing
2 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
packages/amplify-graphql-transformer-core/FixJestEnvironment.js
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,16 @@ | ||
const NodeEnvironment = require('jest-environment-node'); | ||
|
||
class FixJestEnvironment extends NodeEnvironment { | ||
constructor(...args) { | ||
super(...args); | ||
// https://github.com/jestjs/jest/issues/12628 | ||
// sturcturedClone is missing in the jest node environment. | ||
// Newer versions of jest have fixed this, but is not possible to upgrade at this time. | ||
// Newer versions of jest have a performance issue when not used with Node ^20.11.0 | ||
// https://github.com/jestjs/jest/issues/11956 | ||
// Our minimum supported version is Node 18. | ||
this.global.structuredClone = structuredClone; | ||
} | ||
} | ||
|
||
module.exports = FixJestEnvironment; |
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 |
---|---|---|
|
@@ -76,6 +76,7 @@ | |
"coverageReporters": [ | ||
"clover", | ||
"text" | ||
] | ||
], | ||
"testEnvironment": "./FixJestEnvironment.js" | ||
} | ||
} |