From 7c954b51003d838586dab0c4bf3a2edd6f750f79 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Wed, 21 Aug 2024 17:19:54 -0700 Subject: [PATCH] fixup! fixup! POC for basic web platform test integration --- build/BUILD.wpt | 13 ++++++------- src/workerd/api/wpt/BUILD.bazel | 6 +++--- src/workerd/api/wpt/url-test.js | 16 ++++++++-------- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/build/BUILD.wpt b/build/BUILD.wpt index d364d8b5d3e..6169e4a9592 100644 --- a/build/BUILD.wpt +++ b/build/BUILD.wpt @@ -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"], ) - diff --git a/src/workerd/api/wpt/BUILD.bazel b/src/workerd/api/wpt/BUILD.bazel index 841c861609a..ee3dd9c0c81 100644 --- a/src/workerd/api/wpt/BUILD.bazel +++ b/src/workerd/api/wpt/BUILD.bazel @@ -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"], diff --git a/src/workerd/api/wpt/url-test.js b/src/workerd/api/wpt/url-test.js index b2268176101..f7c30b556c3 100644 --- a/src/workerd/api/wpt/url-test.js +++ b/src/workerd/api/wpt/url-test.js @@ -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; + }, }; }; @@ -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) => { @@ -24,7 +24,7 @@ globalThis.test = (callback, message) => { const aerr = new AggregateError([err], message); globalThis.errors.push(aerr); } -} +}; globalThis.errors = []; @@ -38,5 +38,5 @@ export const test = { } throw new Error('Test failed'); } - } + }, };