Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert WPT test harness to TS #3324

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/wpt_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const unitTests :Workerd.Config = (
worker = (
modules = [
(name = "worker", esModule = embed "{test_js}"),
(name = "harness", esModule = embed "../../../../../workerd/src/wpt/harness.js"),
(name = "wpt:harness", esModule = embed "../../../../../workerd/src/wpt/harness.js"),
{modules}
],
bindings = [
Expand Down
2 changes: 1 addition & 1 deletion src/workerd/api/wpt/url-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
// https://opensource.org/licenses/Apache-2.0

import { run } from 'harness';
import { run } from 'wpt:harness';

export const idnaTestV2Window = run('IdnaTestV2.window.js');
export const historical = run('historical.any.js', {
Expand Down
2 changes: 1 addition & 1 deletion src/workerd/api/wpt/urlpattern-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
// https://opensource.org/licenses/Apache-2.0

import { run } from 'harness';
import { run } from 'wpt:harness';

export const urlpatternCompareTests = run(
'urlpattern-compare-tests.tentative.js',
Expand Down
46 changes: 41 additions & 5 deletions src/wpt/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,8 +1,44 @@
filegroup(
load("@aspect_rules_ts//ts:defs.bzl", "ts_project")
load("@npm//:eslint/package_json.bzl", eslint_bin = "bin")

srcs = glob(
[
"*.ts",
],
)

ts_project(
name = "wpt-test-harness",
srcs = glob(
include = ["**/*"],
allow_empty = True,
),
testonly = False,
srcs = srcs,
allow_js = True,
declaration = True,
tsconfig = "tsconfig.json",
visibility = ["//visibility:public"],
deps = [
"//:node_modules/@types/node",
],
)

eslint_bin.eslint_test(
name = "wpt-test-harness@eslint",
size = "large",
args = [
"--config $(location {})".format("eslint.config.mjs"),
"--parser-options project:$(location {})".format("tsconfig.json"),
"-f stylish",
"--report-unused-disable-directives",
] + ["$(location " + src + ")" for src in srcs],
data = srcs + [
"eslint.config.mjs",
"tsconfig.json",
"//:node_modules/@types/node",
"//:prettierrc",
"//tools:base-eslint",
],
tags = ["lint"],
target_compatible_with = select({
"@platforms//os:windows": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
)
3 changes: 3 additions & 0 deletions src/wpt/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { baseConfig } from '../../tools/base.eslint.config.mjs';

export default [...baseConfig({ tsconfigRootDir: import.meta.dirname })];
npaun marked this conversation as resolved.
Show resolved Hide resolved
Loading
Loading