jest-environment-jsdom 27.5.0 → 28.0.0-alpha.2
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.d.ts +34 -21
- package/build/index.js +25 -27
- package/package.json +11 -11
package/build/index.d.ts
CHANGED
|
@@ -5,26 +5,39 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
/// <reference types="node" />
|
|
8
|
-
|
|
9
|
-
import type {
|
|
10
|
-
import {
|
|
11
|
-
import type {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
};
|
|
8
|
+
|
|
9
|
+
import type {Config} from '@jest/types';
|
|
10
|
+
import type {Context} from 'vm';
|
|
11
|
+
import type {EnvironmentContext} from '@jest/environment';
|
|
12
|
+
import type {Global} from '@jest/types';
|
|
13
|
+
import type {JestEnvironment} from '@jest/environment';
|
|
14
|
+
import {JSDOM} from 'jsdom';
|
|
15
|
+
import {LegacyFakeTimers} from '@jest/fake-timers';
|
|
16
|
+
import {ModernFakeTimers} from '@jest/fake-timers';
|
|
17
|
+
import {ModuleMocker} from 'jest-mock';
|
|
18
|
+
|
|
18
19
|
declare class JSDOMEnvironment implements JestEnvironment<number> {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
dom: JSDOM | null;
|
|
21
|
+
fakeTimers: LegacyFakeTimers<number> | null;
|
|
22
|
+
fakeTimersModern: ModernFakeTimers | null;
|
|
23
|
+
global: Win;
|
|
24
|
+
private errorEventListener;
|
|
25
|
+
moduleMocker: ModuleMocker | null;
|
|
26
|
+
constructor(config: Config.ProjectConfig, options?: EnvironmentContext);
|
|
27
|
+
setup(): Promise<void>;
|
|
28
|
+
teardown(): Promise<void>;
|
|
29
|
+
exportConditions(): Array<string>;
|
|
30
|
+
getVmContext(): Context | null;
|
|
29
31
|
}
|
|
30
|
-
export
|
|
32
|
+
export default JSDOMEnvironment;
|
|
33
|
+
|
|
34
|
+
export declare const TestEnvironment: typeof JSDOMEnvironment;
|
|
35
|
+
|
|
36
|
+
declare type Win = Window &
|
|
37
|
+
Global.Global & {
|
|
38
|
+
Error: {
|
|
39
|
+
stackTraceLimit: number;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export {};
|
package/build/index.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.TestEnvironment = void 0;
|
|
7
|
+
|
|
3
8
|
function _jsdom() {
|
|
4
9
|
const data = require('jsdom');
|
|
5
10
|
|
|
@@ -40,34 +45,21 @@ function _jestUtil() {
|
|
|
40
45
|
return data;
|
|
41
46
|
}
|
|
42
47
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
writable: true
|
|
50
|
-
});
|
|
51
|
-
} else {
|
|
52
|
-
obj[key] = value;
|
|
53
|
-
}
|
|
54
|
-
return obj;
|
|
55
|
-
}
|
|
56
|
-
|
|
48
|
+
/**
|
|
49
|
+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
|
|
50
|
+
*
|
|
51
|
+
* This source code is licensed under the MIT license found in the
|
|
52
|
+
* LICENSE file in the root directory of this source tree.
|
|
53
|
+
*/
|
|
57
54
|
class JSDOMEnvironment {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
_defineProperty(this, 'global', void 0);
|
|
66
|
-
|
|
67
|
-
_defineProperty(this, 'errorEventListener', void 0);
|
|
68
|
-
|
|
69
|
-
_defineProperty(this, 'moduleMocker', void 0);
|
|
55
|
+
dom;
|
|
56
|
+
fakeTimers;
|
|
57
|
+
fakeTimersModern;
|
|
58
|
+
global;
|
|
59
|
+
errorEventListener;
|
|
60
|
+
moduleMocker;
|
|
70
61
|
|
|
62
|
+
constructor(config, options) {
|
|
71
63
|
this.dom = new (_jsdom().JSDOM)(
|
|
72
64
|
typeof config.testEnvironmentOptions.html === 'string'
|
|
73
65
|
? config.testEnvironmentOptions.html
|
|
@@ -183,6 +175,10 @@ class JSDOMEnvironment {
|
|
|
183
175
|
this.fakeTimersModern = null;
|
|
184
176
|
}
|
|
185
177
|
|
|
178
|
+
exportConditions() {
|
|
179
|
+
return ['browser'];
|
|
180
|
+
}
|
|
181
|
+
|
|
186
182
|
getVmContext() {
|
|
187
183
|
if (this.dom) {
|
|
188
184
|
return this.dom.getInternalVMContext();
|
|
@@ -192,4 +188,6 @@ class JSDOMEnvironment {
|
|
|
192
188
|
}
|
|
193
189
|
}
|
|
194
190
|
|
|
195
|
-
|
|
191
|
+
exports.default = JSDOMEnvironment;
|
|
192
|
+
const TestEnvironment = JSDOMEnvironment;
|
|
193
|
+
exports.TestEnvironment = TestEnvironment;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jest-environment-jsdom",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "28.0.0-alpha.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/facebook/jest.git",
|
|
@@ -17,23 +17,23 @@
|
|
|
17
17
|
"./package.json": "./package.json"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@jest/environment": "^
|
|
21
|
-
"@jest/fake-timers": "^
|
|
22
|
-
"@jest/types": "^
|
|
20
|
+
"@jest/environment": "^28.0.0-alpha.2",
|
|
21
|
+
"@jest/fake-timers": "^28.0.0-alpha.2",
|
|
22
|
+
"@jest/types": "^28.0.0-alpha.2",
|
|
23
|
+
"@types/jsdom": "^16.2.4",
|
|
23
24
|
"@types/node": "*",
|
|
24
|
-
"jest-mock": "^
|
|
25
|
-
"jest-util": "^
|
|
26
|
-
"jsdom": "^
|
|
25
|
+
"jest-mock": "^28.0.0-alpha.2",
|
|
26
|
+
"jest-util": "^28.0.0-alpha.2",
|
|
27
|
+
"jsdom": "^19.0.0"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
|
-
"@jest/test-utils": "^
|
|
30
|
-
"@types/jsdom": "^16.2.4"
|
|
30
|
+
"@jest/test-utils": "^28.0.0-alpha.2"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|
|
33
|
-
"node": "^
|
|
33
|
+
"node": "^12.13.0 || ^14.15.0 || ^16.13.0 || >=17.0.0"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "694d6bfea56f9cb49d0c7309cdbfff032da198c2"
|
|
39
39
|
}
|