jest-environment-jsdom 27.2.5 → 27.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.js +27 -18
- package/package.json +13 -10
package/build/index.js
CHANGED
|
@@ -68,22 +68,27 @@ class JSDOMEnvironment {
|
|
|
68
68
|
|
|
69
69
|
_defineProperty(this, 'moduleMocker', void 0);
|
|
70
70
|
|
|
71
|
-
this.dom = new (_jsdom().JSDOM)(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
71
|
+
this.dom = new (_jsdom().JSDOM)(
|
|
72
|
+
typeof config.testEnvironmentOptions.html === 'string'
|
|
73
|
+
? config.testEnvironmentOptions.html
|
|
74
|
+
: '<!DOCTYPE html>',
|
|
75
|
+
{
|
|
76
|
+
pretendToBeVisual: true,
|
|
77
|
+
resources:
|
|
78
|
+
typeof config.testEnvironmentOptions.userAgent === 'string'
|
|
79
|
+
? new (_jsdom().ResourceLoader)({
|
|
80
|
+
userAgent: config.testEnvironmentOptions.userAgent
|
|
81
|
+
})
|
|
82
|
+
: undefined,
|
|
83
|
+
runScripts: 'dangerously',
|
|
84
|
+
url: config.testURL,
|
|
85
|
+
virtualConsole: new (_jsdom().VirtualConsole)().sendTo(
|
|
86
|
+
(options === null || options === void 0 ? void 0 : options.console) ||
|
|
87
|
+
console
|
|
88
|
+
),
|
|
89
|
+
...config.testEnvironmentOptions
|
|
90
|
+
}
|
|
91
|
+
);
|
|
87
92
|
const global = (this.global = this.dom.window.document.defaultView);
|
|
88
93
|
|
|
89
94
|
if (!global) {
|
|
@@ -158,12 +163,16 @@ class JSDOMEnvironment {
|
|
|
158
163
|
if (this.global) {
|
|
159
164
|
if (this.errorEventListener) {
|
|
160
165
|
this.global.removeEventListener('error', this.errorEventListener);
|
|
161
|
-
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
this.global.close(); // Dispose "document" to prevent "load" event from triggering.
|
|
169
|
+
// Note that this.global.close() will trigger the CustomElement::disconnectedCallback
|
|
170
|
+
// Do not reset the document before CustomElement disconnectedCallback function has finished running,
|
|
171
|
+
// document should be accessible within disconnectedCallback.
|
|
162
172
|
|
|
163
173
|
Object.defineProperty(this.global, 'document', {
|
|
164
174
|
value: null
|
|
165
175
|
});
|
|
166
|
-
this.global.close();
|
|
167
176
|
}
|
|
168
177
|
|
|
169
178
|
this.errorEventListener = null; // @ts-expect-error
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jest-environment-jsdom",
|
|
3
|
-
"version": "27.
|
|
3
|
+
"version": "27.4.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/facebook/jest.git",
|
|
@@ -10,21 +10,24 @@
|
|
|
10
10
|
"main": "./build/index.js",
|
|
11
11
|
"types": "./build/index.d.ts",
|
|
12
12
|
"exports": {
|
|
13
|
-
".":
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./build/index.d.ts",
|
|
15
|
+
"default": "./build/index.js"
|
|
16
|
+
},
|
|
14
17
|
"./package.json": "./package.json"
|
|
15
18
|
},
|
|
16
19
|
"dependencies": {
|
|
17
|
-
"@jest/environment": "^27.
|
|
18
|
-
"@jest/fake-timers": "^27.
|
|
19
|
-
"@jest/types": "^27.
|
|
20
|
+
"@jest/environment": "^27.4.1",
|
|
21
|
+
"@jest/fake-timers": "^27.4.1",
|
|
22
|
+
"@jest/types": "^27.4.1",
|
|
23
|
+
"@types/jsdom": "^16.2.4",
|
|
20
24
|
"@types/node": "*",
|
|
21
|
-
"jest-mock": "^27.
|
|
22
|
-
"jest-util": "^27.
|
|
25
|
+
"jest-mock": "^27.4.1",
|
|
26
|
+
"jest-util": "^27.4.1",
|
|
23
27
|
"jsdom": "^16.6.0"
|
|
24
28
|
},
|
|
25
29
|
"devDependencies": {
|
|
26
|
-
"@jest/test-utils": "^27.
|
|
27
|
-
"@types/jsdom": "^16.2.4"
|
|
30
|
+
"@jest/test-utils": "^27.4.1"
|
|
28
31
|
},
|
|
29
32
|
"engines": {
|
|
30
33
|
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
|
|
@@ -32,5 +35,5 @@
|
|
|
32
35
|
"publishConfig": {
|
|
33
36
|
"access": "public"
|
|
34
37
|
},
|
|
35
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "fa4a3982766b107ff604ba54081d9e4378f318a9"
|
|
36
39
|
}
|