jest-environment-jsdom 27.4.4 → 28.0.0-alpha.0

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 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
- import type { Context } from 'vm';
9
- import type { EnvironmentContext, JestEnvironment } from '@jest/environment';
10
- import { LegacyFakeTimers, ModernFakeTimers } from '@jest/fake-timers';
11
- import type { Config, Global } from '@jest/types';
12
- import { ModuleMocker } from 'jest-mock';
13
- declare type Win = Window & Global.Global & {
14
- Error: {
15
- stackTraceLimit: number;
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
- private dom;
20
- fakeTimers: LegacyFakeTimers<number> | null;
21
- fakeTimersModern: ModernFakeTimers | null;
22
- global: Win;
23
- private errorEventListener;
24
- moduleMocker: ModuleMocker | null;
25
- constructor(config: Config.ProjectConfig, options?: EnvironmentContext);
26
- setup(): Promise<void>;
27
- teardown(): Promise<void>;
28
- getVmContext(): Context | null;
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 = JSDOMEnvironment;
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
- function _defineProperty(obj, key, value) {
44
- if (key in obj) {
45
- Object.defineProperty(obj, key, {
46
- value: value,
47
- enumerable: true,
48
- configurable: true,
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
- constructor(config, options) {
59
- _defineProperty(this, 'dom', void 0);
60
-
61
- _defineProperty(this, 'fakeTimers', void 0);
62
-
63
- _defineProperty(this, 'fakeTimersModern', void 0);
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
- module.exports = JSDOMEnvironment;
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": "27.4.4",
3
+ "version": "28.0.0-alpha.0",
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": "^27.4.4",
21
- "@jest/fake-timers": "^27.4.2",
22
- "@jest/types": "^27.4.2",
20
+ "@jest/environment": "^28.0.0-alpha.0",
21
+ "@jest/fake-timers": "^28.0.0-alpha.0",
22
+ "@jest/types": "^28.0.0-alpha.0",
23
+ "@types/jsdom": "^16.2.4",
23
24
  "@types/node": "*",
24
- "jest-mock": "^27.4.2",
25
- "jest-util": "^27.4.2",
26
- "jsdom": "^16.6.0"
25
+ "jest-mock": "^28.0.0-alpha.0",
26
+ "jest-util": "^28.0.0-alpha.0",
27
+ "jsdom": "^19.0.0"
27
28
  },
28
29
  "devDependencies": {
29
- "@jest/test-utils": "^27.4.2",
30
- "@types/jsdom": "^16.2.4"
30
+ "@jest/test-utils": "^28.0.0-alpha.0"
31
31
  },
32
32
  "engines": {
33
- "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
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": "e2316126b2e4b9b4272e5a0b651c3cb5b0306369"
38
+ "gitHead": "89275b08977065d98e42ad71fcf223f4ad169f09"
39
39
  }