chore(deps): bump jsdom from 15.2.1 to 20.0.2 (#6591)

* chore(deps): bump jsdom from 15.2.1 to 20.0.2

Bumps [jsdom](https://github.com/jsdom/jsdom) from 15.2.1 to 20.0.2.
- [Release notes](https://github.com/jsdom/jsdom/releases)
- [Changelog](https://github.com/jsdom/jsdom/blob/master/Changelog.md)
- [Commits](https://github.com/jsdom/jsdom/compare/15.2.1...20.0.2)

---
updated-dependencies:
- dependency-name: jsdom
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix(deps): Import jsdom correctly

Use the JSDOM constructor to create a JSDOM instance and then
obtain the needed polyfills from that instances .window property.

* chore(tests): Revert "Updates dependabot to ignore jsdom changes (#4777)"

This reverts commit be1dcb4b94.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
This commit is contained in:
dependabot[bot]
2022-11-14 22:26:04 +00:00
committed by GitHub
parent f64c934f04
commit 15b9cf61df
4 changed files with 1333 additions and 425 deletions

View File

@@ -10,12 +10,6 @@ updates:
target-branch: "develop"
schedule:
interval: "weekly"
ignore:
- dependency-name: "jsdom"
# For jsdom, ignore all updates for version 16.
# We should test that this does not cause issue
# google/blockly-samples#665 when version 17 is released.
versions: "16.x"
commit-message:
prefix: "chore(deps)"
labels:

1743
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -114,6 +114,6 @@
"yargs": "^17.2.1"
},
"dependencies": {
"jsdom": "15.2.1"
"jsdom": "20.0.2"
}
}

View File

@@ -16,9 +16,10 @@
// Override textToDomDocument and provide Node.js alternatives to DOMParser and
// XMLSerializer.
if (typeof globalThis.document !== 'object') {
const jsdom = require('jsdom/lib/jsdom/living');
globalThis.DOMParser = jsdom.DOMParser;
globalThis.XMLSerializer = jsdom.XMLSerializer;
const {JSDOM} = require('jsdom');
const {window} = new JSDOM(`<!DOCTYPE html>`);
globalThis.DOMParser = window.DOMParser;
globalThis.XMLSerializer = window.XMLSerializer;
const xmlDocument = Blockly.utils.xml.textToDomDocument(
`<xml xmlns="${Blockly.utils.xml.NAME_SPACE}"></xml>`);
Blockly.utils.xml.setDocument(xmlDocument);