-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.js
39 lines (33 loc) · 1.27 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const JSDOMEnvironment = require('jest-environment-jsdom').default
class FixedJSDOMEnvironment extends JSDOMEnvironment {
constructor(...args) {
super(...args)
/**
* @note Opt-out from JSDOM using browser-style resolution
* for dependencies. This is simply incorrect, as JSDOM is
* not a browser, and loading browser-oriented bundles in
* Node.js will break things.
*
* Consider migrating to a more modern test runner if you
* don't want to deal with this.
*/
this.customExportConditions = args.customExportConditions || ['']
this.global.TextDecoder = TextDecoder
this.global.TextEncoder = TextEncoder
this.global.TextDecoderStream = TextDecoderStream
this.global.TextEncoderStream = TextEncoderStream
this.global.ReadableStream = ReadableStream
this.global.Blob = Blob
this.global.Headers = Headers
this.global.FormData = FormData
this.global.Request = Request
this.global.Response = Response
this.global.fetch = fetch
this.global.structuredClone = structuredClone
this.global.URL = URL
this.global.URLSearchParams = URLSearchParams
this.global.BroadcastChannel = BroadcastChannel
this.global.TransformStream = TransformStream
}
}
module.exports = FixedJSDOMEnvironment