jest-environment-jsdom 22.2.2 → 22.4.3
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 +33 -32
- package/package.json +3 -3
package/build/index.js
CHANGED
|
@@ -1,43 +1,44 @@
|
|
|
1
|
-
'use strict';
|
|
1
|
+
'use strict';
|
|
2
2
|
|
|
3
|
+
var _jestUtil;
|
|
3
4
|
|
|
5
|
+
function _load_jestUtil() {
|
|
6
|
+
return _jestUtil = require('jest-util');
|
|
7
|
+
}
|
|
4
8
|
|
|
9
|
+
var _jestMock;
|
|
5
10
|
|
|
11
|
+
function _load_jestMock() {
|
|
12
|
+
return _jestMock = _interopRequireDefault(require('jest-mock'));
|
|
13
|
+
}
|
|
6
14
|
|
|
15
|
+
var _jsdom;
|
|
7
16
|
|
|
17
|
+
function _load_jsdom() {
|
|
18
|
+
return _jsdom = require('jsdom');
|
|
19
|
+
}
|
|
8
20
|
|
|
21
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
|
25
|
+
*
|
|
26
|
+
* This source code is licensed under the MIT license found in the
|
|
27
|
+
* LICENSE file in the root directory of this source tree.
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
10
30
|
|
|
31
|
+
class JSDOMEnvironment {
|
|
11
32
|
|
|
33
|
+
constructor(config) {
|
|
34
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
12
35
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
function _load_jestUtil() {return _jestUtil = require('jest-util');}var _jestMock;
|
|
16
|
-
function _load_jestMock() {return _jestMock = _interopRequireDefault(require('jest-mock'));}var _jsdom;
|
|
17
|
-
function _load_jsdom() {return _jsdom = require('jsdom');}function _interopRequireDefault(obj) {return obj && obj.__esModule ? obj : { default: obj };} /**
|
|
18
|
-
* Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
|
19
|
-
*
|
|
20
|
-
* This source code is licensed under the MIT license found in the
|
|
21
|
-
* LICENSE file in the root directory of this source tree.
|
|
22
|
-
*
|
|
23
|
-
*/class JSDOMEnvironment {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
constructor(config) {let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
27
|
-
this.dom = new (_jsdom || _load_jsdom()).JSDOM(
|
|
28
|
-
'<!DOCTYPE html>',
|
|
29
|
-
Object.assign(
|
|
30
|
-
{
|
|
36
|
+
this.dom = new (_jsdom || _load_jsdom()).JSDOM('<!DOCTYPE html>', Object.assign({
|
|
31
37
|
pretendToBeVisual: true,
|
|
32
38
|
runScripts: 'dangerously',
|
|
33
39
|
url: config.testURL,
|
|
34
|
-
virtualConsole: new (_jsdom || _load_jsdom()).VirtualConsole().sendTo(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
config.testEnvironmentOptions));
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
virtualConsole: new (_jsdom || _load_jsdom()).VirtualConsole().sendTo(options.console || console)
|
|
41
|
+
}, config.testEnvironmentOptions));
|
|
41
42
|
const global = this.global = this.dom.window.document.defaultView;
|
|
42
43
|
// Node's error-message stack size is limited at 10, but it's pretty useful
|
|
43
44
|
// to see more than that when a test fails.
|
|
@@ -74,15 +75,15 @@ function _load_jsdom() {return _jsdom = require('jsdom');}function _interopRequi
|
|
|
74
75
|
|
|
75
76
|
const timerConfig = {
|
|
76
77
|
idToRef: id => id,
|
|
77
|
-
refToId: ref => ref
|
|
78
|
-
|
|
78
|
+
refToId: ref => ref
|
|
79
|
+
};
|
|
79
80
|
|
|
80
81
|
this.fakeTimers = new (_jestUtil || _load_jestUtil()).FakeTimers({
|
|
81
82
|
config,
|
|
82
83
|
global,
|
|
83
84
|
moduleMocker: this.moduleMocker,
|
|
84
|
-
timerConfig
|
|
85
|
-
|
|
85
|
+
timerConfig
|
|
86
|
+
});
|
|
86
87
|
}
|
|
87
88
|
|
|
88
89
|
setup() {
|
|
@@ -111,7 +112,7 @@ function _load_jsdom() {return _jsdom = require('jsdom');}function _interopRequi
|
|
|
111
112
|
return this.dom.runVMScript(script);
|
|
112
113
|
}
|
|
113
114
|
return null;
|
|
114
|
-
}
|
|
115
|
-
|
|
115
|
+
}
|
|
116
|
+
}
|
|
116
117
|
|
|
117
118
|
module.exports = JSDOMEnvironment;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jest-environment-jsdom",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.4.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/facebook/jest.git"
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"main": "build/index.js",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"jest-mock": "^22.
|
|
12
|
-
"jest-util": "^22.
|
|
11
|
+
"jest-mock": "^22.4.3",
|
|
12
|
+
"jest-util": "^22.4.3",
|
|
13
13
|
"jsdom": "^11.5.1"
|
|
14
14
|
}
|
|
15
15
|
}
|