jest-environment-jsdom 24.5.0 → 24.8.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/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ MIT License
2
+
3
+ For Jest software
4
+
5
+ Copyright (c) 2014-present, Facebook, Inc.
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in all
15
+ copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ SOFTWARE.
package/build/index.d.ts CHANGED
@@ -11,15 +11,15 @@ import { ModuleMocker } from 'jest-mock';
11
11
  import { JestFakeTimers as FakeTimers } from '@jest/fake-timers';
12
12
  import { JestEnvironment, EnvironmentContext } from '@jest/environment';
13
13
  import { JSDOM } from 'jsdom';
14
- interface Win extends Window {
14
+ declare type Win = Window & Global.Global & {
15
15
  Error: {
16
16
  stackTraceLimit: number;
17
17
  };
18
- }
18
+ };
19
19
  declare class JSDOMEnvironment implements JestEnvironment {
20
20
  dom: JSDOM | null;
21
21
  fakeTimers: FakeTimers<number> | null;
22
- global: Global.Global | Win | null;
22
+ global: Win;
23
23
  errorEventListener: ((event: Event & {
24
24
  error: Error;
25
25
  }) => void) | null;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,aAAa,CAAC;AAE3C,OAAa,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAC,cAAc,IAAI,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAC,KAAK,EAAiB,MAAM,OAAO,CAAC;AAI5C,UAAU,GAAI,SAAQ,MAAM;IAC1B,KAAK,EAAE;QACL,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;CACH;AASD,cAAM,gBAAiB,YAAW,eAAe;IAC/C,GAAG,EAAE,KAAK,GAAG,IAAI,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAEtC,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC;IACnC,kBAAkB,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,GAAG;QAAC,KAAK,EAAE,KAAK,CAAA;KAAC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IACrE,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;gBAEtB,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,OAAO,GAAE,kBAAuB;IAgE1E,KAAK;IAIL,QAAQ;IAqBR,SAAS,CAAC,MAAM,EAAE,MAAM;CAMzB;AAED,SAAS,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAC,MAAM,EAAC,MAAM,IAAI,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAE,MAAM,EAAC,MAAM,aAAa,CAAC;AAE3C,OAAa,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAC,cAAc,IAAI,UAAU,EAAC,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAC,KAAK,EAAiB,MAAM,OAAO,CAAC;AAI5C,aAAK,GAAG,GAAG,MAAM,GACf,MAAM,CAAC,MAAM,GAAG;IACd,KAAK,EAAE;QACL,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;CACH,CAAC;AAEJ,cAAM,gBAAiB,YAAW,eAAe;IAC/C,GAAG,EAAE,KAAK,GAAG,IAAI,CAAC;IAClB,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IACtC,MAAM,EAAE,GAAG,CAAC;IACZ,kBAAkB,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,GAAG;QAAC,KAAK,EAAE,KAAK,CAAA;KAAC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IACrE,YAAY,EAAE,YAAY,GAAG,IAAI,CAAC;gBAEtB,MAAM,EAAE,MAAM,CAAC,aAAa,EAAE,OAAO,GAAE,kBAAuB;IAgE1E,KAAK;IAIL,QAAQ;IAoBR,SAAS,CAAC,MAAM,EAAE,MAAM;CAMzB;AAED,SAAS,gBAAgB,CAAC"}
package/build/index.js CHANGED
@@ -76,14 +76,18 @@ function _defineProperty(obj, key, value) {
76
76
  return obj;
77
77
  }
78
78
 
79
- function isWin(globals) {
80
- return globals.document !== undefined;
81
- } // A lot of the globals expected by other APIs are `NodeJS.Global` and not
82
- // `Window`, so we need to cast here and there
83
-
84
79
  class JSDOMEnvironment {
85
- // @ts-ignore
86
80
  constructor(config, options = {}) {
81
+ _defineProperty(this, 'dom', void 0);
82
+
83
+ _defineProperty(this, 'fakeTimers', void 0);
84
+
85
+ _defineProperty(this, 'global', void 0);
86
+
87
+ _defineProperty(this, 'errorEventListener', void 0);
88
+
89
+ _defineProperty(this, 'moduleMocker', void 0);
90
+
87
91
  this.dom = new (_jsdom()).JSDOM(
88
92
  '<!DOCTYPE html>',
89
93
  _objectSpread(
@@ -160,20 +164,18 @@ class JSDOMEnvironment {
160
164
  }
161
165
 
162
166
  if (this.global) {
163
- if (this.errorEventListener && isWin(this.global)) {
167
+ if (this.errorEventListener) {
164
168
  this.global.removeEventListener('error', this.errorEventListener);
165
169
  } // Dispose "document" to prevent "load" event from triggering.
166
170
 
167
171
  Object.defineProperty(this.global, 'document', {
168
172
  value: null
169
173
  });
170
-
171
- if (isWin(this.global)) {
172
- this.global.close();
173
- }
174
+ this.global.close();
174
175
  }
175
176
 
176
- this.errorEventListener = null;
177
+ this.errorEventListener = null; // @ts-ignore
178
+
177
179
  this.global = null;
178
180
  this.dom = null;
179
181
  this.fakeTimers = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jest-environment-jsdom",
3
- "version": "24.5.0",
3
+ "version": "24.8.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/facebook/jest.git",
@@ -10,11 +10,11 @@
10
10
  "main": "build/index.js",
11
11
  "types": "build/index.d.ts",
12
12
  "dependencies": {
13
- "@jest/environment": "^24.5.0",
14
- "@jest/fake-timers": "^24.5.0",
15
- "@jest/types": "^24.5.0",
16
- "jest-mock": "^24.5.0",
17
- "jest-util": "^24.5.0",
13
+ "@jest/environment": "^24.8.0",
14
+ "@jest/fake-timers": "^24.8.0",
15
+ "@jest/types": "^24.8.0",
16
+ "jest-mock": "^24.8.0",
17
+ "jest-util": "^24.8.0",
18
18
  "jsdom": "^11.5.1"
19
19
  },
20
20
  "devDependencies": {
@@ -26,5 +26,5 @@
26
26
  "publishConfig": {
27
27
  "access": "public"
28
28
  },
29
- "gitHead": "800533020f5b2f153615c821ed7cb12fd868fa6f"
29
+ "gitHead": "845728f24b3ef41e450595c384e9b5c9fdf248a4"
30
30
  }