mirror of
https://github.com/gravitational/teleport.git
synced 2026-09-24 16:17:11 +08:00
add structuredClone to jest JSDOMEnvironment (#36213)
This commit is contained in:
@@ -19,6 +19,14 @@ export default class PatchedJSDOMEnvironment extends JSDOMEnvironment {
|
||||
const { global } = super(...args);
|
||||
if (!global.TextEncoder) global.TextEncoder = TextEncoder;
|
||||
if (!global.TextDecoder) global.TextDecoder = TextDecoder;
|
||||
|
||||
// TODO(sshah): Remove this once JSDOM provides structuredClone.
|
||||
// https://github.com/jsdom/jsdom/issues/3363
|
||||
if (!global.structuredClone) {
|
||||
global.structuredClone = val => {
|
||||
return JSON.parse(JSON.stringify(val));
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
export const TestEnvironment = PatchedJSDOMEnvironment;
|
||||
|
||||
Reference in New Issue
Block a user