From ead14f5bf0ae43524f055320f373a6e2ce947476 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Thu, 29 Jun 2017 20:03:03 +0900 Subject: [PATCH] Upgrade jsdom to version 11.0.0 (#3994) --- package.json | 2 +- spec/javascript/setup.js | 18 ++++++------------ yarn.lock | 20 +++++++++++++------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index 60f9af1e9..feb59dc90 100644 --- a/package.json +++ b/package.json @@ -123,7 +123,7 @@ "eslint": "^3.19.0", "eslint-plugin-jsx-a11y": "^4.0.0", "eslint-plugin-react": "^6.10.3", - "jsdom": "^10.1.0", + "jsdom": "^11.0.0", "mocha": "^3.4.1", "react-intl-translations-manager": "^5.0.0", "react-test-renderer": "^15.6.1", diff --git a/spec/javascript/setup.js b/spec/javascript/setup.js index 7d4b2866e..c9c8aed07 100644 --- a/spec/javascript/setup.js +++ b/spec/javascript/setup.js @@ -1,19 +1,13 @@ -import { jsdom } from 'jsdom/lib/old-api'; +import { JSDOM } from 'jsdom'; import chai from 'chai'; import chaiEnzyme from 'chai-enzyme'; chai.use(chaiEnzyme()); -var exposedProperties = ['window', 'navigator', 'document']; - -global.document = jsdom(''); -global.window = document.defaultView; -Object.keys(document.defaultView).forEach((property) => { +const { window } = new JSDOM('', { + userAgent: 'node.js', +}); +Object.keys(window).forEach(property => { if (typeof global[property] === 'undefined') { - exposedProperties.push(property); - global[property] = document.defaultView[property]; + global[property] = window[property]; } }); - -global.navigator = { - userAgent: 'node.js', -}; diff --git a/yarn.lock b/yarn.lock index b8af49d62..4b5e3ae17 100644 --- a/yarn.lock +++ b/yarn.lock @@ -121,6 +121,10 @@ react-split-pane "^0.1.63" redux "^3.6.0" +"@types/node@^6.0.46": + version "6.0.78" + resolved "https://registry.yarnpkg.com/@types/node/-/node-6.0.78.tgz#5d4a3f579c1524e01ee21bf474e6fba09198f470" + abab@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.3.tgz#b81de5f7274ec4e756d797cd834f303642724e5d" @@ -3911,9 +3915,9 @@ jsbn@~0.1.0: version "0.1.1" resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" -jsdom@^10.1.0: - version "10.1.0" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-10.1.0.tgz#7765e00fd5c3567f34985a1c86ff466a61dacc6a" +jsdom@^11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.0.0.tgz#1ee507cb2c0b16c875002476b1a8557d951353e5" dependencies: abab "^1.0.3" acorn "^4.0.4" @@ -3925,7 +3929,7 @@ jsdom@^10.1.0: escodegen "^1.6.1" html-encoding-sniffer "^1.0.1" nwmatcher ">= 1.3.9 < 2.0.0" - parse5 "^1.5.1" + parse5 "^3.0.2" pn "^1.0.0" request "^2.79.0" request-promise-native "^1.0.3" @@ -4919,9 +4923,11 @@ parse-json@^2.2.0: dependencies: error-ex "^1.2.0" -parse5@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-1.5.1.tgz#9b7f3b0de32be78dc2401b17573ccaf0f6f59d94" +parse5@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-3.0.2.tgz#05eff57f0ef4577fb144a79f8b9a967a6cc44510" + dependencies: + "@types/node" "^6.0.46" parseurl@~1.3.1: version "1.3.1"