Skip to content

Commit

Permalink
fixup! fixup! POC for basic web platform test integration
Browse files Browse the repository at this point in the history
  • Loading branch information
jasnell committed Aug 22, 2024
1 parent 4dffeb3 commit 7c954b5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
13 changes: 6 additions & 7 deletions build/BUILD.wpt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
filegroup(
name = "url",
srcs = glob(
include = ["url/**/*"],
allow_empty = True,
),
visibility = ["//visibility:public"],
name = "url",
srcs = glob(
include = ["url/**/*"],
allow_empty = True,
),
visibility = ["//visibility:public"],
)

6 changes: 3 additions & 3 deletions src/workerd/api/wpt/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ load("//:build/wd_test.bzl", "wd_test")
[wd_test(
src = f,
args = [
"--experimental",
"--experimental",
],
data = [
f.removesuffix(".wd-test") + ".js",
"@wpt//:url",
f.removesuffix(".wd-test") + ".js",
"@wpt//:url",
],
) for f in glob(
["**/*.wd-test"],
Expand Down
16 changes: 8 additions & 8 deletions src/workerd/api/wpt/url-test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import {
strictEqual,
} from 'assert';
import { strictEqual } from 'assert';

globalThis.fetch = async(url) => {
globalThis.fetch = async (url) => {
const { default: data } = await import(url);
return {
async json() { return data; },
async json() {
return data;
},
};
};

Expand All @@ -14,7 +14,7 @@ globalThis.promise_test = (callback) => {
};

globalThis.assert_equals = (a, b, c) => {
strictEqual(a,b,c);
strictEqual(a, b, c);
};

globalThis.test = (callback, message) => {
Expand All @@ -24,7 +24,7 @@ globalThis.test = (callback, message) => {
const aerr = new AggregateError([err], message);
globalThis.errors.push(aerr);
}
}
};

globalThis.errors = [];

Expand All @@ -38,5 +38,5 @@ export const test = {
}
throw new Error('Test failed');
}
}
},
};

0 comments on commit 7c954b5

Please sign in to comment.