mirror of
https://github.com/bitwarden/browser
synced 2025-12-06 00:13:28 +00:00
[PM-5781] Anon addy forwarder (#7654)
This commit is contained in:
@@ -1,22 +1,28 @@
|
||||
import JSDOMEnvironment from "jest-environment-jsdom";
|
||||
|
||||
/**
|
||||
* https://github.com/jsdom/jsdom/issues/3363#issuecomment-1467894943
|
||||
* Adds nodes structuredClone implementation to the global object of jsdom.
|
||||
* use by either adding this file to the testEnvironment property of jest config
|
||||
* or by adding the following to the top spec file:
|
||||
* Maps Node's APIs to the jsdom global object to work around
|
||||
* missing methods in Jest's 'jsdom' test environment.
|
||||
*
|
||||
* ```
|
||||
* /**
|
||||
* * @jest-environment ../shared/test.environment.ts
|
||||
* *\/
|
||||
* ```
|
||||
* @remarks To use this test environment, reference this file
|
||||
* in the `testEnvironment` property of the Jest configuration
|
||||
* or adding a `@jest-environment path/to/test.environment.ts`
|
||||
* directive to your test file. Consult the Jest documentation
|
||||
* for more information.
|
||||
*
|
||||
* @see 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);
|
||||
|
||||
// FIXME https://github.com/jsdom/jsdom/issues/3363
|
||||
// FIXME https://github.com/jsdom/jsdom/issues/3363#issuecomment-1467894943
|
||||
this.global.structuredClone = structuredClone;
|
||||
|
||||
// FIXME https://github.com/jsdom/jsdom/issues/1724#issuecomment-1446858041
|
||||
this.global.fetch = fetch;
|
||||
this.global.Headers = Headers;
|
||||
this.global.Request = Request;
|
||||
this.global.Response = Response;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user