MISC: Use structuredClone() for deep cloning (#1077)

This commit is contained in:
LJ
2024-02-10 02:10:19 -07:00
committed by GitHub
parent 6bd50e6f24
commit fd5b0f8241
9 changed files with 27 additions and 32 deletions

View File

@@ -1,10 +1,13 @@
import JSDOMEnvironment from "jest-environment-jsdom";
import { cloneDeep } from "lodash";
// https://github.com/facebook/jest/blob/v29.4.3/website/versioned_docs/version-29.4/Configuration.md#testenvironment-string
export default class FixJSDOMEnvironment extends JSDOMEnvironment {
constructor(...args: ConstructorParameters<typeof JSDOMEnvironment>) {
super(...args);
// TODO Tests aren't polyfilled.
this.global.structuredClone = cloneDeep;
// FIXME https://github.com/nodejs/node/issues/35889
// Add missing importActual() function to mirror requireActual(),
// which lets us work around the ESM bug.