Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/jest-environment-jsdom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"dependencies": {
"jest-mock": "^21.2.0",
"jest-util": "^21.2.1",
"jsdom": "^11.3.0"
"jsdom": "~11.2.0"
}
}
12 changes: 6 additions & 6 deletions packages/jest-environment-jsdom/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import mock from 'jest-mock';
import {JSDOM} from 'jsdom';

class JSDOMEnvironment {
document: ?Object;
dom: ?Object;
fakeTimers: ?FakeTimers<number>;
global: ?Global;
errorEventListener: ?Function;
Expand All @@ -25,11 +25,11 @@ class JSDOMEnvironment {
constructor(config: ProjectConfig) {
const jsdomInitialized = process.hrtime();

this.document = new JSDOM('<!DOCTYPE html>', {
this.dom = new JSDOM('<!DOCTYPE html>', {
runScripts: 'dangerously',
url: config.testURL,
});
const global = (this.global = this.document.window.document.defaultView);
const global = (this.global = this.dom.window.document.defaultView);
// Node's error-message stack size is limited at 10, but it's pretty useful
// to see more than that when a test fails.
this.global.Error.stackTraceLimit = 100;
Expand Down Expand Up @@ -102,14 +102,14 @@ class JSDOMEnvironment {
}
this.errorEventListener = null;
this.global = null;
this.document = null;
this.dom = null;
this.fakeTimers = null;
return Promise.resolve();
}

runScript(script: Script): ?any {
if (this.document) {
return this.document.runVMScript(script);
if (this.dom) {
return this.dom.runVMScript(script);
}
return null;
}
Expand Down
47 changes: 21 additions & 26 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ [email protected]:
mime-types "~2.1.11"
negotiator "0.6.1"

acorn-globals@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.1.0.tgz#ab716025dbe17c54d3ef81d32ece2b2d99fe2538"
acorn-globals@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-3.1.0.tgz#fd8270f71fbb4996b004fa880ee5d46573a731bf"
dependencies:
acorn "^5.0.0"
acorn "^4.0.4"

acorn-jsx@^3.0.0:
version "3.0.1"
Expand All @@ -50,11 +50,11 @@ acorn@^3.0.4:
version "3.3.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a"

acorn@^4.0.1, acorn@^4.0.3:
acorn@^4.0.1, acorn@^4.0.3, acorn@^4.0.4:
version "4.0.13"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787"

acorn@^5.0.0, acorn@^5.1.1, acorn@^5.1.2:
acorn@^5.1.1:
version "5.1.2"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.1.2.tgz#911cb53e036807cf0fa778dc5d370fbd864246d7"

Expand Down Expand Up @@ -2077,10 +2077,6 @@ domelementtype@~1.1.1:
version "1.1.3"
resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-1.1.3.tgz#bd28773e2642881aec51544924299c5cd822185b"

domexception@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.0.tgz#81fe5df81b3f057052cde3a9fa9bf536a85b9ab0"

domhandler@^2.3.0:
version "2.4.1"
resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-2.4.1.tgz#892e47000a99be55bbf3774ffea0561d8879c259"
Expand Down Expand Up @@ -2250,7 +2246,7 @@ [email protected], escape-string-regexp@^1.0.2, escape-string-regexp@^1
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"

escodegen@^1.9.0:
escodegen@^1.6.1:
version "1.9.0"
resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.9.0.tgz#9811a2f265dc1cd3894420ee3717064b632b8852"
dependencies:
Expand Down Expand Up @@ -3588,31 +3584,30 @@ jschardet@^1.4.2:
version "1.5.1"
resolved "https://registry.yarnpkg.com/jschardet/-/jschardet-1.5.1.tgz#c519f629f86b3a5bedba58a88d311309eec097f9"

jsdom@^11.3.0:
version "11.3.0"
resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.3.0.tgz#7b2dfe6227d014084d80f6b3e98fa1e4cef199e7"
jsdom@~11.2.0:
version "11.2.0"
resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.2.0.tgz#4f6b8736af3357c3af7227a3b54a5bda1c513fd6"
dependencies:
abab "^1.0.3"
acorn "^5.1.2"
acorn-globals "^4.0.0"
acorn "^4.0.4"
acorn-globals "^3.1.0"
array-equal "^1.0.0"
content-type-parser "^1.0.1"
cssom ">= 0.3.2 < 0.4.0"
cssstyle ">= 0.2.37 < 0.3.0"
domexception "^1.0.0"
escodegen "^1.9.0"
escodegen "^1.6.1"
html-encoding-sniffer "^1.0.1"
nwmatcher "^1.4.1"
parse5 "^3.0.2"
pn "^1.0.0"
request "^2.83.0"
request "^2.79.0"
request-promise-native "^1.0.3"
sax "^1.2.1"
symbol-tree "^3.2.1"
tough-cookie "^2.3.3"
webidl-conversions "^4.0.2"
tough-cookie "^2.3.2"
webidl-conversions "^4.0.0"
whatwg-encoding "^1.0.1"
whatwg-url "^6.3.0"
whatwg-url "^6.1.0"
xml-name-validator "^2.0.1"

jsesc@^1.3.0:
Expand Down Expand Up @@ -5175,7 +5170,7 @@ [email protected], request@^2.81.0:
tunnel-agent "^0.6.0"
uuid "^3.0.0"

request@^2.83.0:
request@^2.79.0:
version "2.83.0"
resolved "https://registry.yarnpkg.com/request/-/request-2.83.0.tgz#ca0b65da02ed62935887808e6f510381034e3356"
dependencies:
Expand Down Expand Up @@ -5869,7 +5864,7 @@ to-fast-properties@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47"

tough-cookie@>=2.3.3, tough-cookie@^2.3.3, tough-cookie@~2.3.3:
tough-cookie@>=2.3.3, tough-cookie@^2.3.2, tough-cookie@~2.3.3:
version "2.3.3"
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.3.3.tgz#0b618a5565b6dea90bf3425d04d55edc475a7561"
dependencies:
Expand Down Expand Up @@ -6133,7 +6128,7 @@ wcwidth@^1.0.0:
dependencies:
defaults "^1.0.3"

webidl-conversions@^4.0.1, webidl-conversions@^4.0.2:
webidl-conversions@^4.0.0, webidl-conversions@^4.0.1:
version "4.0.2"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad"

Expand All @@ -6147,7 +6142,7 @@ whatwg-fetch@>=0.10.0:
version "2.0.3"
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz#9c84ec2dcf68187ff00bc64e1274b442176e1c84"

whatwg-url@^6.3.0:
whatwg-url@^6.1.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.3.0.tgz#597ee5488371abe7922c843397ddec1ae94c048d"
dependencies:
Expand Down