Skip to content

Commit 2167822

Browse files
committed
Add a temporary workaround for a Node 18 bug
Also fix the overwritten-customElements-global.html test some of which fails in browsers and should not have been committed.
1 parent 7512ce9 commit 2167822

File tree

4 files changed

+16
-30
lines changed

4 files changed

+16
-30
lines changed

test/web-platform-tests/run-wpts.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ const validReasons = new Set([
1919
"fail-with-canvas",
2020
"timeout",
2121
"flaky",
22-
"needs-canvas"
22+
"needs-canvas",
23+
// Node 18 has a bug in its vm module that causes certain property redefinition tests to fail.
24+
// They start passing again on Node 19.
25+
"fail-node18"
2326
]);
2427

2528
const manifestFilename = path.resolve(__dirname, "wpt-manifest.json");

test/web-platform-tests/to-run.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -1282,6 +1282,7 @@ event-handler-all-global-events.html: [fail, Depends on fetch]
12821282
event-handler-attributes-body-window.html: [fail, Depends on fetch]
12831283
event-handler-attributes-frameset-window.html: [fail, Depends on fetch]
12841284
event-handler-attributes-windowless-body.html: [fail, Depends on fetch]
1285+
event-handler-handleEvent-ignored.html: [fail-node18]
12851286
event-handler-processing-algorithm-error/document-synthetic-errorevent.html: [fail, ErrorEvent.error can't be set to undefined]
12861287
event-handler-processing-algorithm-error/script-element.html: [timeout, Unknown]
12871288
event-handler-processing-algorithm-error/synthetic-errorevent-click.html: [fail, Needs Worker implementation]

test/web-platform-tests/to-upstream/custom-elements/overwritten-customElements-global.html

-27
Original file line numberDiff line numberDiff line change
@@ -6,33 +6,6 @@
66
<body>
77
<script>
88
"use strict";
9-
10-
test(() => {
11-
class SomeElement1 extends HTMLElement {}
12-
customElements.define("some-element-1", SomeElement1);
13-
14-
const savedCustomElements = Object.getOwnPropertyDescriptor(window, "customElements");
15-
window.customElements = {};
16-
17-
const element = document.createElement("some-element-1");
18-
assert_true(element instanceof SomeElement1);
19-
20-
Object.defineProperty(window, "customElements", savedCustomElements);
21-
}, "Custom elements can still be created after `window.customElements` is overwritten.");
22-
23-
test(() => {
24-
class SomeElement2 extends HTMLElement {}
25-
customElements.define("some-element-2", SomeElement2);
26-
27-
const savedCustomElements = Object.getOwnPropertyDescriptor(window, "customElements");
28-
window.customElements = {};
29-
30-
const element = new SomeElement2();
31-
assert_true(element instanceof SomeElement2);
32-
33-
Object.defineProperty(window, "customElements", savedCustomElements);
34-
}, "Custom elements can still be constructed after `window.customElements` is overwritten.");
35-
369
test(() => {
3710
class SomeElement3 extends HTMLElement {}
3811
customElements.define("some-element-3", SomeElement3);

test/web-platform-tests/utils.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,18 @@ const { Canvas } = require("../../lib/jsdom/utils.js");
33

44
const hasCanvas = Boolean(Canvas);
55

6+
const nodeMajorVersion = process.versions.node.split(".")[0];
7+
68
exports.resolveReason = reason => {
7-
if (["fail-slow", "timeout", "flaky"].includes(reason) ||
8-
(["fail-with-canvas", "needs-canvas"].includes(reason) && !hasCanvas)) {
9+
if (["fail-slow", "timeout", "flaky"].includes(reason)) {
10+
return "skip";
11+
}
12+
13+
if (["fail-with-canvas", "needs-canvas"].includes(reason) && !hasCanvas) {
14+
return "skip";
15+
}
16+
17+
if (reason === "fail-node18" && nodeMajorVersion === "18") {
918
return "skip";
1019
}
1120

0 commit comments

Comments
 (0)