diff --git a/.github/workflows/jsdom-ci.yml b/.github/workflows/jsdom-ci.yml
index fa72894e69..414e3a489c 100644
--- a/.github/workflows/jsdom-ci.yml
+++ b/.github/workflows/jsdom-ci.yml
@@ -50,24 +50,6 @@ jobs:
run: yarn --frozen-lockfile
- name: Run tests
run: yarn add canvas && yarn test --retries 1
- build-with-browser:
- env:
- TEST_SUITE: 'browser'
- runs-on: ubuntu-20.04
- steps:
- - uses: actions/checkout@v3
- with:
- submodules: 'recursive'
- - name: Run web browser tests
- uses: actions/setup-node@v3
- with:
- node-version: '18'
- - name: Setup HOSTS file for Web Platform Test server
- run: ./test/web-platform-tests/tests/wpt make-hosts-file | sudo tee -a /etc/hosts
- - name: Install dependencies
- run: yarn --frozen-lockfile
- - name: Run tests
- run: yarn test-browser
build:
runs-on: ubuntu-latest
strategy:
diff --git a/Contributing.md b/Contributing.md
index 8033638775..3855d23ba7 100644
--- a/Contributing.md
+++ b/Contributing.md
@@ -78,27 +78,11 @@ To write such a test that, simply add a file in `test/api/`, following the surro
Although ideally you should not need to worry about this, there are some tests that are for legacy reasons not in the right format; they use Mocha, but really should be web platform tests. We're keeping them around for coverage until we can convert them. If you run `yarn test`, you will get the full test suite, including such old tests.
-### Testing against the browser
-
-jsdom has experimental support to run in directly in a browser, in both the main document and in a web worker! So we try run as many tests as possible in browsers too. Currently we only test in Chrome, since it has the same JavaScript features as the Node.js environment we usually develop in. So you'll need Chrome installed on your machine.
-
-The mocha test cases are executed in Chrome using [karma](https://karma-runner.github.io/). Currently, web platform tests are not executed in the browser yet.
-
-**To run all browser tests:** `yarn test-browser`
-
-**To run the karma tests in an iframe:** `yarn test-browser-iframe`
-
-**To run the karma tests in a web worker:** `yarn test-browser-worker`
-
## Benchmarks
This project cares about performance. There are a number of benchmarks that you can run. If you suspect your contribution has an impact on the performance of existing functionality, make sure you run the benchmarks before and after your change so that you can compare.
-You can also run the benchmarks using the native DOM implementation of Chrome. A comparison with jsdom will automatically be made for you. If your new feature is much slower than the alternative DOM implementation, there might be an unexpected bottleneck somewhere in your change.
-
-**To run benchmarks in Node.js:** `yarn benchmark`
-
-**To run benchmarks in the browser:** `yarn benchmark-browser`, then open `benchmark/browser-runner.html` in Chrome (or Chromium) and use the developer console to execute the `run()` function.
+**To run benchmarks:** `yarn benchmark`
## Issues
diff --git a/README.md b/README.md
index 4b1bce6f67..efe154b771 100644
--- a/README.md
+++ b/README.md
@@ -446,16 +446,6 @@ Timers in the jsdom (set by `window.setTimeout()` or `window.setInterval()`) wil
If you want to be sure to shut down a jsdom window, use `window.close()`, which will terminate all running timers (and also remove any event listeners on the window and document).
-### Running jsdom inside a web browser
-
-jsdom has some support for being run inside a web browser, using [browserify](https://browserify.org/). That is, inside a web browser, you can use a browserified jsdom to create an entirely self-contained set of plain JavaScript objects which look and act much like the browser's existing DOM objects, while being entirely independent of them. "Virtual DOM", indeed!
-
-jsdom's primary target is still Node.js, and so we use language features that are only present in recent Node.js versions. Thus, older browsers will likely not work. (Even transpilation will not help: we use `Proxy`s extensively throughout the jsdom codebase.)
-
-Notably, jsdom works well inside a web worker. The original contributor, [@lawnsea](https://github.com/lawnsea/), who made this possible, has [published a paper](https://pdfs.semanticscholar.org/47f0/6bb6607a975500a30e9e52d7c9fbc0034e27.pdf) about his project which uses this capability.
-
-Not everything works perfectly when running jsdom inside a web browser. Sometimes that is because of fundamental limitations (such as not having filesystem access), but sometimes it is simply because we haven't spent enough time making the appropriate small tweaks. Bug reports are certainly welcome.
-
### Debugging the DOM using Chrome DevTools
In Node.js you can debug programs using Chrome DevTools. See the [official documentation](https://nodejs.org/en/docs/inspector/) for how to get started.
diff --git a/benchmark/browser-runner.html b/benchmark/browser-runner.html
deleted file mode 100644
index a78c26acfc..0000000000
--- a/benchmark/browser-runner.html
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
- JSDom benchmarks
-
-
-
-
- Execute run('dom/construction/createElement')
to run a benchmark.
- Or run()
to run them all.
- You can also specify to only run a benchmark for a specific implementation,
- "jsdom" or "native": run('dom/construction', 'jsdom')
.
-
-
-
diff --git a/benchmark/browser-runner.js b/benchmark/browser-runner.js
deleted file mode 100644
index 6c2168d928..0000000000
--- a/benchmark/browser-runner.js
+++ /dev/null
@@ -1,47 +0,0 @@
-"use strict";
-/* eslint no-console: 0 */
-
-const consoleReporter = require("./console-reporter");
-const pathToSuites = require("./path-to-suites");
-const benchmarks = require(".");
-
-module.exports = function (suites, documentImplementation) {
- if (typeof suites === "string") {
- suites = suites.trim().split(/,/);
- }
-
- let suitesToRun = pathToSuites(benchmarks, suites);
- suitesToRun.forEach(consoleReporter);
-
- suitesToRun = suitesToRun.map(suite => {
- let runSuite = suite;
- if (documentImplementation) {
- runSuite = suite.filter(benchmark => benchmark.jsdomDocumentImplementation === documentImplementation);
- runSuite.name = suite.name;
- consoleReporter(runSuite);
- }
-
- return runSuite;
- });
-
- function runNext() {
- /* eslint-disable no-invalid-this */
- if (this && this.off) {
- // there is no .once()
- this.off("complete", runNext);
- }
- /* eslint-enable no-invalid-this */
-
- const suite = suitesToRun.shift();
- if (!suite) {
- console.log("Done!");
- return;
- }
-
- suite.off("complete", runNext);
- suite.on("complete", runNext);
- suite.run({ async: true });
- }
-
- runNext();
-};
diff --git a/benchmark/document-suite.js b/benchmark/document-suite.js
index d3e41eba85..e9c2fcce92 100644
--- a/benchmark/document-suite.js
+++ b/benchmark/document-suite.js
@@ -1,12 +1,10 @@
"use strict";
const Benchmark = require("benchmark");
const jsdomBenchmark = require("./jsdom-benchmark");
-
-// jsdom might be an empty object if omitted by browserify
const jsdom = require("..");
const nativeDoc = global.document;
-const jsdomDoc = jsdom.JSDOM && (new jsdom.JSDOM()).window.document;
+const jsdomDoc = (new jsdom.JSDOM()).window.document;
function noop() {
// intentional no-op function
@@ -71,19 +69,16 @@ module.exports = function documentSuite(optionsArg) {
addBenchmark(suite, benchmark);
}
- if (jsdomDoc) {
- const newOptions = {
-
- ...options,
- ...benchmarkFunctions(jsdomDoc, options),
- jsdomDocumentImplementation: "jsdom"
- };
- const benchmark = jsdomBenchmark(newOptions);
+ const newOptions = {
+ ...options,
+ ...benchmarkFunctions(jsdomDoc, options),
+ jsdomDocumentImplementation: "jsdom"
+ };
+ const benchmark = jsdomBenchmark(newOptions);
- // extra space in "jsdom " so that it aligns with "native"
- benchmark.name = benchmark.name ? benchmark.name + " :: jsdom " : "jsdom ";
- addBenchmark(suite, benchmark);
- }
+ // extra space in "jsdom " so that it aligns with "native"
+ benchmark.name = benchmark.name ? benchmark.name + " :: jsdom " : "jsdom ";
+ addBenchmark(suite, benchmark);
return suite;
};
diff --git a/benchmark/runner.js b/benchmark/runner.js
index aa93f01589..139bc8eb95 100755
--- a/benchmark/runner.js
+++ b/benchmark/runner.js
@@ -5,9 +5,6 @@
const consoleReporter = require("./console-reporter");
const pathToSuites = require("./path-to-suites");
const benchmarks = require(".");
-const fs = require("fs");
-const path = require("path");
-const { toFileUrl } = require("../lib/jsdom/utils");
const yargs = require("yargs/yargs");
const { hideBin } = require("yargs/helpers");
@@ -18,28 +15,8 @@ const { argv } = yargs(hideBin(process.argv))
alias: "s",
describe: "suites that you want to run, e.g.: dom/construction/createElement dom/foo"
})
- .option("bundle", {
- type: "boolean",
- describe: "generate the JavaScript bundle required to run benchmarks in a browser"
- })
.help();
-if (argv.bundle) {
- const bundle = require("browserify")({ debug: true });
- bundle.require(path.resolve(__dirname, ".."), { expose: "jsdom" });
- bundle.require(path.resolve(__dirname, "browser-runner.js"), { expose: "jsdom-browser-runner" });
-
- bundle.bundle()
- .pipe(fs.createWriteStream(path.resolve(__dirname, "browser-bundle.js")))
- .on("finish", () => {
- console.info(
- "Open the following page in Chrome to begin benchmarking:",
- toFileUrl(path.resolve(__dirname, "browser-runner.html"))
- );
- });
- return;
-}
-
let suitesToRun;
if (argv.suites) {
suitesToRun = pathToSuites(benchmarks, argv.suites);
diff --git a/lib/jsdom/living/websockets/WebSocket-impl-browser.js b/lib/jsdom/living/websockets/WebSocket-impl-browser.js
deleted file mode 100644
index 6a2ab6317c..0000000000
--- a/lib/jsdom/living/websockets/WebSocket-impl-browser.js
+++ /dev/null
@@ -1,175 +0,0 @@
-/* eslint-env browser */
-
-"use strict";
-
-const DOMException = require("domexception/webidl2js-wrapper");
-const { parseURL, serializeURL, serializeURLOrigin } = require("whatwg-url");
-
-const { setupForSimpleEventAccessors } = require("../helpers/create-event-accessor");
-const { fireAnEvent } = require("../helpers/events");
-
-const EventTargetImpl = require("../events/EventTarget-impl").implementation;
-
-const idlUtils = require("../generated/utils");
-const Blob = require("../generated/Blob");
-const CloseEvent = require("../generated/CloseEvent");
-const MessageEvent = require("../generated/MessageEvent");
-
-const productions = {
- // https://tools.ietf.org/html/rfc7230#section-3.2.6
- token: /^[!#$%&'*+\-.^_`|~\dA-Za-z]+$/
-};
-
-// https://tools.ietf.org/html/rfc6455#section-4.3
-// See Sec-WebSocket-Protocol-Client, which is for the syntax of an entire header value. This function checks if a
-// single header conforms to the rules.
-function verifySecWebSocketProtocol(str) {
- return productions.token.test(str);
-}
-
-const openSockets = new WeakMap();
-
-class WebSocketImpl extends EventTargetImpl {
- constructor(constructorArgs, privateData) {
- super([], privateData);
- const { window } = privateData;
- this._ownerDocument = idlUtils.implForWrapper(window._document);
-
- const url = constructorArgs[0];
- let protocols = constructorArgs[1] !== undefined ? constructorArgs[1] : [];
-
- const urlRecord = parseURL(url);
- if (urlRecord === null) {
- throw DOMException.create(this._globalObject, [`The URL '${url}' is invalid.`, "SyntaxError"]);
- }
- if (urlRecord.scheme !== "ws" && urlRecord.scheme !== "wss") {
- throw DOMException.create(this._globalObject, [
- `The URL's scheme must be either 'ws' or 'wss'. '${urlRecord.scheme}' is not allowed.`,
- "SyntaxError"
- ]);
- }
- if (urlRecord.fragment !== null) {
- throw DOMException.create(this._globalObject, [
- `The URL contains a fragment identifier ('${urlRecord.fragment}'). Fragment identifiers ` +
- "are not allowed in WebSocket URLs.",
- "SyntaxError"
- ]);
- }
-
- if (typeof protocols === "string") {
- protocols = [protocols];
- }
- const protocolSet = new Set();
- for (const protocol of protocols) {
- if (!verifySecWebSocketProtocol(protocol)) {
- throw DOMException.create(this._globalObject, [`The subprotocol '${protocol}' is invalid.`, "SyntaxError"]);
- }
- const lowered = protocol.toLowerCase();
- if (protocolSet.has(lowered)) {
- throw DOMException.create(this._globalObject, [
- `The subprotocol '${protocol}' is duplicated.`,
- "SyntaxError"
- ]);
- }
- protocolSet.add(lowered);
- }
-
- this._urlRecord = urlRecord;
- this.url = serializeURL(urlRecord);
-
- this._ws = new WebSocket(this.url, protocols);
-
- this._ws.onopen = () => {
- fireAnEvent("open", this);
- };
- this._ws.onerror = () => {
- fireAnEvent("error", this);
- };
- this._ws.onclose = event => {
- fireAnEvent("close", this, CloseEvent, {
- wasClean: event.wasClean,
- code: event.code,
- reason: event.reason
- });
- };
- this._ws.onmessage = event => {
- fireAnEvent("message", this, MessageEvent, {
- data: event.data,
- origin: serializeURLOrigin(this._urlRecord)
- });
- };
-
- let openSocketsForWindow = openSockets.get(window._globalProxy);
- if (openSocketsForWindow === undefined) {
- openSocketsForWindow = new Set();
- openSockets.set(window._globalProxy, openSocketsForWindow);
- }
- openSocketsForWindow.add(this);
- }
-
- // https://html.spec.whatwg.org/multipage/web-sockets.html#make-disappear
- _makeDisappear() {
- this._eventListeners = Object.create(null);
- this._ws.close(1001);
- }
-
- static cleanUpWindow(window) {
- const openSocketsForWindow = openSockets.get(window._globalProxy);
- if (openSocketsForWindow !== undefined) {
- for (const ws of openSocketsForWindow) {
- ws._makeDisappear();
- }
- }
- }
-
- get readyState() {
- return this._ws.readyState;
- }
-
- get bufferedAmount() {
- return this._ws.bufferedAmount;
- }
-
- get extensions() {
- return this._ws.extensions;
- }
-
- get protocol() {
- return this._ws.protocol;
- }
-
- close(code = undefined, reason = undefined) {
- if (code !== undefined && code !== 1000 && !(code >= 3000 && code <= 4999)) {
- throw DOMException.create(this._globalObject, [
- `The code must be either 1000, or between 3000 and 4999. ${code} is neither.`,
- "InvalidAccessError"
- ]);
- }
- if (reason !== undefined && Buffer.byteLength(reason, "utf8") > 123) {
- throw DOMException.create(this._globalObject, [
- "The message must not be greater than 123 bytes.",
- "SyntaxError"
- ]);
- }
- return this._ws.close(code, reason);
- }
-
- get binaryType() {
- return this._ws.binaryType;
- }
-
- set binaryType(val) {
- this._ws.binaryType = val;
- }
-
- send(data) {
- if (Blob.isImpl(data)) {
- data = data._buffer;
- }
- this._ws.send(data);
- }
-}
-
-setupForSimpleEventAccessors(WebSocketImpl.prototype, ["open", "message", "error", "close"]);
-
-exports.implementation = WebSocketImpl;
diff --git a/lib/jsdom/utils.js b/lib/jsdom/utils.js
index d8b0c24dd7..e3097527ce 100644
--- a/lib/jsdom/utils.js
+++ b/lib/jsdom/utils.js
@@ -145,19 +145,8 @@ exports.treeOrderSorter = function (a, b) {
};
/* eslint-disable global-require */
-
-exports.Canvas = null;
-let canvasInstalled = false;
try {
- require.resolve("canvas");
- canvasInstalled = true;
-} catch (e) {
- // canvas is not installed
-}
-if (canvasInstalled) {
- const Canvas = require("canvas");
- if (typeof Canvas.createCanvas === "function") {
- // In browserify, the require will succeed but return an empty object
- exports.Canvas = Canvas;
- }
+ exports.Canvas = require("canvas");
+} catch {
+ exports.Canvas = null;
}
diff --git a/lib/jsdom/vm-shim.js b/lib/jsdom/vm-shim.js
deleted file mode 100644
index 185679eb26..0000000000
--- a/lib/jsdom/vm-shim.js
+++ /dev/null
@@ -1,106 +0,0 @@
-"use strict";
-/* eslint-disable no-new-func */
-const acorn = require("acorn");
-const findGlobals = require("acorn-globals");
-const escodegen = require("escodegen");
-const jsGlobals = require("./browser/js-globals.json");
-
-// We can't use the default browserify vm shim because it doesn't work in a web worker.
-
-// "eval" is skipped because it's set to a function that calls `runInContext`:
-const jsGlobalEntriesToInstall = Object.entries(jsGlobals).filter(([name]) => name !== "eval" && name in global);
-
-exports.createContext = function (sandbox) {
- // TODO: This should probably use a symbol
- Object.defineProperty(sandbox, "__isVMShimContext", {
- value: true,
- writable: true,
- configurable: true,
- enumerable: false
- });
-
- for (const [globalName, globalPropDesc] of jsGlobalEntriesToInstall) {
- const propDesc = { ...globalPropDesc, value: global[globalName] };
- Object.defineProperty(sandbox, globalName, propDesc);
- }
-
- Object.defineProperty(sandbox, "eval", {
- value(code) {
- return exports.runInContext(code, sandbox);
- },
- writable: true,
- configurable: true,
- enumerable: false
- });
-};
-
-exports.isContext = function (sandbox) {
- return sandbox.__isVMShimContext;
-};
-
-exports.runInContext = function (code, contextifiedSandbox, options) {
- if (code === "this") {
- // Special case for during window creation.
- return contextifiedSandbox;
- }
-
- if (options === undefined) {
- options = {};
- }
-
- const comments = [];
- const tokens = [];
- const ast = acorn.parse(code, {
- allowReturnOutsideFunction: true,
- ranges: true,
- // collect comments in Esprima's format
- onComment: comments,
- // collect token ranges
- onToken: tokens
- });
-
- // make sure we keep comments
- escodegen.attachComments(ast, comments, tokens);
-
- const globals = findGlobals(ast);
- for (let i = 0; i < globals.length; ++i) {
- if (globals[i].name === "window" || globals[i].name === "this") {
- continue;
- }
-
- const { nodes } = globals[i];
- for (let j = 0; j < nodes.length; ++j) {
- const { type, name } = nodes[j];
- nodes[j].type = "MemberExpression";
- nodes[j].property = { name, type };
- nodes[j].computed = false;
- nodes[j].object = {
- name: "window",
- type: "Identifier"
- };
- }
- }
-
- const lastNode = ast.body[ast.body.length - 1];
- if (lastNode.type === "ExpressionStatement") {
- lastNode.type = "ReturnStatement";
- lastNode.argument = lastNode.expression;
- delete lastNode.expression;
- }
-
- const rewrittenCode = escodegen.generate(ast, { comment: true });
- const suffix = options.filename !== undefined ? "\n//# sourceURL=" + options.filename : "";
-
- return Function("window", rewrittenCode + suffix).bind(contextifiedSandbox)(contextifiedSandbox);
-};
-
-exports.Script = class VMShimScript {
- constructor(code, options) {
- this._code = code;
- this._options = options;
- }
-
- runInContext(sandbox, options) {
- return exports.runInContext(this._code, sandbox, { ...this._options, ...options });
- }
-};
diff --git a/package.json b/package.json
index 94c3673abd..4eb93f1631 100644
--- a/package.json
+++ b/package.json
@@ -21,13 +21,10 @@
"repository": "jsdom/jsdom",
"dependencies": {
"abab": "^2.0.6",
- "acorn": "^8.8.2",
- "acorn-globals": "^7.0.0",
"cssstyle": "^3.0.0",
"data-urls": "^4.0.0",
"decimal.js": "^10.4.3",
"domexception": "^4.0.0",
- "escodegen": "^2.0.0",
"form-data": "^4.0.0",
"html-encoding-sniffer": "^3.0.0",
"http-proxy-agent": "^5.0.0",
@@ -58,31 +55,19 @@
"devDependencies": {
"@domenic/eslint-config": "^3.0.0",
"benchmark": "^2.1.4",
- "browserify": "^17.0.0",
"chai": "^4.3.7",
"eslint": "^8.39.0",
"eslint-plugin-html": "^7.1.0",
"eslint-plugin-jsdom-internal": "link:./scripts/eslint-plugin",
"js-yaml": "^4.1.0",
- "karma": "^6.4.2",
- "karma-browserify": "^8.1.0",
- "karma-chrome-launcher": "^3.2.0",
- "karma-mocha": "^2.0.1",
- "karma-mocha-webworker": "^1.3.0",
"minimatch": "^9.0.0",
"mocha": "^10.2.0",
"mocha-sugar-free": "^1.4.0",
"pngjs": "^7.0.0",
"server-destroy": "^1.0.1",
- "watchify": "^4.0.0",
"webidl2js": "^17.1.0",
"yargs": "^17.7.2"
},
- "browser": {
- "canvas": false,
- "vm": "./lib/jsdom/vm-shim.js",
- "./lib/jsdom/living/websockets/WebSocket-impl.js": "./lib/jsdom/living/websockets/WebSocket-impl-browser.js"
- },
"scripts": {
"prepare": "yarn convert-idl && yarn generate-js-globals",
"pretest": "yarn prepare && yarn init-wpt",
@@ -91,16 +76,12 @@
"test-mocha": "mocha",
"test-api": "mocha test/api",
"test": "mocha test/index.js",
- "test-browser-iframe": "karma start test/karma.conf.js",
- "test-browser-worker": "karma start test/karma-webworker.conf.js",
- "test-browser": "yarn test-browser-iframe && yarn test-browser-worker",
"lint": "eslint . --cache --ext .js,.html",
"init-wpt": "git submodule update --init --recursive",
"reset-wpt": "rm -rf ./test/web-platform-tests/tests && yarn init-wpt",
"update-wpt": "git submodule update --recursive --remote && cd test/web-platform-tests/tests && python3 wpt.py manifest --path ../wpt-manifest.json",
"update-authors": "git log --format=\"%aN <%aE>\" | sort -f | uniq > AUTHORS.txt",
"benchmark": "node ./benchmark/runner",
- "benchmark-browser": "node ./benchmark/runner --bundle",
"convert-idl": "node ./scripts/webidl/convert.js",
"generate-js-globals": "node ./scripts/generate-js-globals.js"
},
diff --git a/test/api/cookies.js b/test/api/cookies.js
index 0ac0bb8ce9..315653f64e 100644
--- a/test/api/cookies.js
+++ b/test/api/cookies.js
@@ -22,7 +22,7 @@ const testCookies = [
let testHost, testSecuredHost;
-describe("Cookie processing", { skipIfBrowser: true }, () => {
+describe("Cookie processing", () => {
let server, securedServer;
before(() => {
diff --git a/test/api/encoding.js b/test/api/encoding.js
index dc1d007c23..3e2cb0283e 100644
--- a/test/api/encoding.js
+++ b/test/api/encoding.js
@@ -115,7 +115,7 @@ describe("API: encoding detection", () => {
});
});
- describe("constructor, given binary data", { skipIfBrowser: true }, () => {
+ describe("constructor, given binary data", () => {
describe("with no contentType option given", () => {
for (const binaryDataType of Object.keys(factories)) {
const factory = factories[binaryDataType];
@@ -175,7 +175,7 @@ describe("API: encoding detection", () => {
});
});
- describe("fromFile", { skipIfBrowser: true }, () => {
+ describe("fromFile", () => {
for (const encodingFixture of Object.keys(encodingFixtures)) {
const { name, body } = encodingFixtures[encodingFixture];
@@ -188,7 +188,7 @@ describe("API: encoding detection", () => {
}
});
- describe("fromURL", { skipIfBrowser: true }, () => {
+ describe("fromURL", () => {
let server, host;
before(() => {
return createServer((req, res) => {
diff --git a/test/api/from-file.js b/test/api/from-file.js
index f6eb3346a2..bcadabad90 100644
--- a/test/api/from-file.js
+++ b/test/api/from-file.js
@@ -11,7 +11,7 @@ function fromFixtureFile(fixture, options) {
return JSDOM.fromFile(path.resolve(__dirname, "fixtures/from-file", fixture), options);
}
-describe("API: JSDOM.fromFile()", { skipIfBrowser: true }, () => {
+describe("API: JSDOM.fromFile()", () => {
it("should return a rejected promise for a nonexistant file", () => {
return Promise.all([
assert.isRejected(JSDOM.fromFile(undefined)),
diff --git a/test/api/from-outside.js b/test/api/from-outside.js
index cc835dda3f..476eb00d86 100644
--- a/test/api/from-outside.js
+++ b/test/api/from-outside.js
@@ -42,7 +42,7 @@ describe("Test cases only possible to test from the outside", () => {
assert.equal(window.counter, counterBeforeSecondDelay);
});
- it("frees up callback handles passed to setTimeout", { skipIfBrowser: true, timeout: 5000 }, () => {
+ it("frees up callback handles passed to setTimeout", { timeout: 5000 }, () => {
const timeoutWithGcFixturePath = path.resolve(__dirname, "./fixtures/timeout-with-gc.js");
const { status, stdout } = spawnSync("node", ["--expose-gc", timeoutWithGcFixturePath], { encoding: "utf-8" });
diff --git a/test/api/from-url.js b/test/api/from-url.js
index a3add171c8..4a624fce36 100644
--- a/test/api/from-url.js
+++ b/test/api/from-url.js
@@ -1,5 +1,4 @@
"use strict";
-/* globals location: readonly */
const zlib = require("zlib");
const { assert } = require("chai");
const { describe, it } = require("mocha-sugar-free");
@@ -34,28 +33,7 @@ describe("API: JSDOM.fromURL()", () => {
});
});
- describe("tests only in the browser", { skipUnlessBrowser: true }, () => {
- it("should return a rejected promise for a 404", () => {
- const url = location.origin + "/404/";
-
- return assert.isRejected(JSDOM.fromURL(url));
- });
-
- it("should preserve full request URL", async () => {
- const url = location.origin + "/";
- const search = "?a=1";
- const fragment = "#fragment";
- const fullURL = url + search + fragment;
-
- const dom = await JSDOM.fromURL(fullURL);
- assert.strictEqual(dom.window.document.URL, fullURL);
- assert.strictEqual(dom.window.location.href, fullURL);
- assert.strictEqual(dom.window.location.search, search);
- assert.strictEqual(dom.window.location.hash, fragment);
- });
- });
-
- describe("tests that use a server", { skipIfBrowser: true }, () => {
+ describe("tests that use a server", () => {
it("should return a rejected promise for a 404", async () => {
const url = await simpleServer(404);
diff --git a/test/api/methods.js b/test/api/methods.js
index a161cfb477..b8ea82c7ad 100644
--- a/test/api/methods.js
+++ b/test/api/methods.js
@@ -168,7 +168,7 @@ describe("API: JSDOM class's methods", () => {
});
});
- describe("getInternalVMContext", { skipIfBrowser: true }, () => {
+ describe("getInternalVMContext", () => {
it("should throw when runScripts is left as the default", () => {
const dom = new JSDOM();
diff --git a/test/api/options-run-scripts.js b/test/api/options-run-scripts.js
index d4cc49af72..da38d357b2 100644
--- a/test/api/options-run-scripts.js
+++ b/test/api/options-run-scripts.js
@@ -36,10 +36,7 @@ describe("API: runScripts constructor option", () => {
assert.strictEqual(dom.window.document.body.children.length, 3);
});
- // In the browser, vm-shim uses Function() on the code to be evaluated, which inserts an extra first line. So we are
- // always off by one there. See https://github.com/jsdom/jsdom/issues/2004.
- it("should execute
-