Skip to content
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: 2 additions & 0 deletions build/wpt_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ const unitTests :Workerd.Config = (
(name = "SIDECAR_HOSTNAME", fromEnvironment = "SIDECAR_HOSTNAME"),
(name = "HTTP_PORT", fromEnvironment = "HTTP_PORT"),
(name = "HTTPS_PORT", fromEnvironment = "HTTPS_PORT"),
(name = "WS_PORT", fromEnvironment = "WS_PORT"),
(name = "WSS_PORT", fromEnvironment = "WSS_PORT"),
(name = "GEN_TEST_CONFIG", fromEnvironment = "GEN_TEST_CONFIG"),
(name = "GEN_TEST_REPORT", fromEnvironment = "GEN_TEST_REPORT"),
(name = "GEN_TEST_STATS", fromEnvironment = "GEN_TEST_STATS"),
Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ new-wpt-test test_name:
echo 'wpt_test(name = "{{test_name}}", config = "{{test_name}}-test.ts", wpt_directory = "@wpt//:{{test_name}}@module")' >> src/wpt/BUILD.bazel

./tools/cross/format.py
bazel test //src/wpt:{{test_name}} --test_env=GEN_TEST_CONFIG=1 --test_output=streamed
bazel test //src/wpt:{{test_name}}@ --test_env=GEN_TEST_CONFIG=1 --test_output=streamed

# Specify the full Bazel target name for the test to be created.
# e.g. just new-test //src/workerd/api/tests:v8-temporal-test
Expand Down
34 changes: 34 additions & 0 deletions src/wpt/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,37 @@ wpt_test(
config = "performance-timeline-test.ts",
wpt_directory = "@wpt//:performance-timeline@module",
)

wpt_test(
name = "websockets",
size = "large",
config = "websockets-test.ts",
start_server = True,
target_compatible_with = select({
# TODO(later): Provide a Windows version of the sidecar script we wrote to invoke wptserve.
# Currently we only have a Unix shell script.
"@platforms//os:windows": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
wpt_directory = "@wpt//:websockets@module",
)

wpt_test(
name = "eventsource",
size = "large",
config = "eventsource-test.ts",
start_server = True,
target_compatible_with = select({
# TODO(later): Provide a Windows version of the sidecar script we wrote to invoke wptserve.
# Currently we only have a Unix shell script.
"@platforms//os:windows": ["@platforms//:incompatible"],
"//conditions:default": [],
}),
wpt_directory = "@wpt//:eventsource@module",
)

wpt_test(
name = "webidl",
config = "webidl-test.ts",
wpt_directory = "@wpt//:webidl@module",
)
251 changes: 251 additions & 0 deletions src/wpt/eventsource-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
// Copyright (c) 2017-2026 Cloudflare, Inc.
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
// https://opensource.org/licenses/Apache-2.0

import { type TestRunnerConfig } from 'harness/harness';

export default {
'dedicated-worker/eventsource-close.js': {
comment: 'Uses postMessage which is not available in workerd',
omittedTests: true,
},
'dedicated-worker/eventsource-close2.js': {
comment: 'Uses self.close() which is not available in workerd',
omittedTests: true,
},
'dedicated-worker/eventsource-constructor-no-new.any.js': {},
'dedicated-worker/eventsource-constructor-non-same-origin.js': {
comment: 'Uses postMessage which is not available in workerd',
omittedTests: true,
},
'dedicated-worker/eventsource-constructor-url-bogus.js': {
comment: 'Uses postMessage which is not available in workerd',
omittedTests: true,
},
'dedicated-worker/eventsource-eventtarget.worker.js': {
comment: 'Uses importScripts which is not available in workerd',
omittedTests: true,
},
'dedicated-worker/eventsource-onmesage.js': {
comment: 'Uses postMessage which is not available in workerd',
omittedTests: true,
},
'dedicated-worker/eventsource-onopen.js': {
comment: 'Uses postMessage which is not available in workerd',
omittedTests: true,
},
'dedicated-worker/eventsource-prototype.js': {
comment: 'Uses postMessage which is not available in workerd',
omittedTests: true,
},
'dedicated-worker/eventsource-url.js': {
comment: 'Uses postMessage which is not available in workerd',
omittedTests: true,
},
'event-data.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'eventsource-close.window.js': {
comment: 'Window-specific tests are not supported',
omittedTests: true,
},
'eventsource-constructor-document-domain.window.js': {
comment: 'Window-specific tests are not supported',
omittedTests: true,
},
'eventsource-constructor-empty-url.any.js': {
comment:
'workerd throws SyntaxError for empty URL instead of resolving to self.location',
expectedFailures: ['EventSource constructor with an empty url.'],
},
'eventsource-constructor-non-same-origin.window.js': {
comment: 'Window-specific tests are not supported',
omittedTests: true,
},
'eventsource-constructor-stringify.window.js': {
comment: 'Window-specific tests are not supported',
omittedTests: true,
},
'eventsource-constructor-url-bogus.any.js': {},
'eventsource-cross-origin.window.js': {
comment: 'Window-specific tests are not supported',
omittedTests: true,
},
'eventsource-eventtarget.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'eventsource-onmessage-trusted.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'eventsource-onmessage.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'eventsource-onopen.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'eventsource-prototype.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'eventsource-reconnect.window.js': {
comment: 'Window-specific tests are not supported',
omittedTests: true,
},
'eventsource-request-cancellation.window.js': {
comment: 'Window-specific tests are not supported',
omittedTests: true,
},
'eventsource-url.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-bom-2.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-bom.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-comments.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-data-before-final-empty-line.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-field-data.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-field-event-empty.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-field-event.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-field-id-2.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-field-id-3.window.js': {
comment: 'Window-specific tests are not supported',
omittedTests: true,
},
'format-field-id-null.window.js': {
comment: 'Window-specific tests are not supported',
omittedTests: true,
},
'format-field-id.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-field-parsing.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-field-retry-bogus.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-field-retry-empty.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-field-retry.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-field-unknown.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-leading-space.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-mime-bogus.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-mime-trailing-semicolon.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-mime-valid-bogus.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-newlines.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-null-character.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'format-utf-8.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'request-accept.any.js': {
comment: 'EventSource does not support relative URLs in workerd',
expectedFailures: true,
},
'request-cache-control.any.js': {
comment: 'Test times out due to relative URL handling',
omittedTests: true,
},
'request-credentials.window.js': {
comment: 'Window-specific tests are not supported',
omittedTests: true,
},
'request-redirect.window.js': {
comment: 'Window-specific tests are not supported',
omittedTests: true,
},
'request-status-error.window.js': {
comment: 'Window-specific tests are not supported',
omittedTests: true,
},
'shared-worker/eventsource-close.js': {
comment: 'SharedWorker tests are not applicable to workerd',
omittedTests: true,
},
'shared-worker/eventsource-constructor-non-same-origin.js': {
comment: 'SharedWorker tests are not applicable to workerd',
omittedTests: true,
},
'shared-worker/eventsource-constructor-url-bogus.js': {
comment: 'SharedWorker tests are not applicable to workerd',
omittedTests: true,
},
'shared-worker/eventsource-eventtarget.js': {
comment: 'SharedWorker tests are not applicable to workerd',
omittedTests: true,
},
'shared-worker/eventsource-onmesage.js': {
comment: 'SharedWorker tests are not applicable to workerd',
omittedTests: true,
},
'shared-worker/eventsource-onopen.js': {
comment: 'SharedWorker tests are not applicable to workerd',
omittedTests: true,
},
'shared-worker/eventsource-prototype.js': {
comment: 'SharedWorker tests are not applicable to workerd',
omittedTests: true,
},
'shared-worker/eventsource-url.js': {
comment: 'SharedWorker tests are not applicable to workerd',
omittedTests: true,
},
} satisfies TestRunnerConfig;
Loading