fleet/ee/fleetd-chrome/jsdomwithfetch.ts
Zach Wasserman 42b3e5602e
Fleetd for Chrome (#10281)
# Checklist for submitter

If some of the following don't apply, delete the relevant line.

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Added/updated tests
- [x] Manual QA for all new/changed functionality
2023-03-16 09:01:10 -03:00

16 lines
517 B
TypeScript

// Adapted from https://github.com/jsdom/jsdom/issues/1724#issuecomment-1446858041
import JSDOMEnvironment from "jest-environment-jsdom";
export default class JSDOMWithFetch extends JSDOMEnvironment {
constructor(...args: ConstructorParameters<typeof JSDOMEnvironment>) {
super(...args);
// Fixes for missing fetch (https://github.com/jsdom/jsdom/issues/1724)
this.global.fetch = fetch;
this.global.Headers = Headers;
this.global.Request = Request;
this.global.Response = Response;
}
}