Skip to content

Commit 28e9bce

Browse files
committed
add eventsource web-platform test suite
1 parent c670984 commit 28e9bce

File tree

2 files changed

+264
-0
lines changed

2 files changed

+264
-0
lines changed

src/wpt/BUILD.bazel

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,16 @@ wpt_test(
143143
}),
144144
wpt_directory = "@wpt//:websockets@module",
145145
)
146+
147+
wpt_test(
148+
name = "eventsource",
149+
config = "eventsource-test.ts",
150+
start_server = True,
151+
target_compatible_with = select({
152+
# TODO(later): Provide a Windows version of the sidecar script we wrote to invoke wptserve.
153+
# Currently we only have a Unix shell script.
154+
"@platforms//os:windows": ["@platforms//:incompatible"],
155+
"//conditions:default": [],
156+
}),
157+
wpt_directory = "@wpt//:eventsource@module",
158+
)

src/wpt/eventsource-test.ts

Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
// Copyright (c) 2017-2026 Cloudflare, Inc.
2+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
3+
// https://opensource.org/licenses/Apache-2.0
4+
5+
import { type TestRunnerConfig } from 'harness/harness';
6+
7+
export default {
8+
'dedicated-worker/eventsource-close.js': {
9+
comment: 'Uses postMessage which is not available in workerd',
10+
omittedTests: true,
11+
},
12+
'dedicated-worker/eventsource-close2.js': {
13+
comment: 'Uses self.close() which is not available in workerd',
14+
omittedTests: true,
15+
},
16+
'dedicated-worker/eventsource-constructor-no-new.any.js': {},
17+
'dedicated-worker/eventsource-constructor-non-same-origin.js': {
18+
comment: 'Uses postMessage which is not available in workerd',
19+
omittedTests: true,
20+
},
21+
'dedicated-worker/eventsource-constructor-url-bogus.js': {
22+
comment: 'Uses postMessage which is not available in workerd',
23+
omittedTests: true,
24+
},
25+
'dedicated-worker/eventsource-eventtarget.worker.js': {
26+
comment: 'Uses importScripts which is not available in workerd',
27+
omittedTests: true,
28+
},
29+
'dedicated-worker/eventsource-onmesage.js': {
30+
comment: 'Uses postMessage which is not available in workerd',
31+
omittedTests: true,
32+
},
33+
'dedicated-worker/eventsource-onopen.js': {
34+
comment: 'Uses postMessage which is not available in workerd',
35+
omittedTests: true,
36+
},
37+
'dedicated-worker/eventsource-prototype.js': {
38+
comment: 'Uses postMessage which is not available in workerd',
39+
omittedTests: true,
40+
},
41+
'dedicated-worker/eventsource-url.js': {
42+
comment: 'Uses postMessage which is not available in workerd',
43+
omittedTests: true,
44+
},
45+
'event-data.any.js': {
46+
comment: 'EventSource does not support relative URLs in workerd',
47+
expectedFailures: true,
48+
},
49+
'eventsource-close.window.js': {
50+
comment: 'Window-specific tests are not supported',
51+
omittedTests: true,
52+
},
53+
'eventsource-constructor-document-domain.window.js': {
54+
comment: 'Window-specific tests are not supported',
55+
omittedTests: true,
56+
},
57+
'eventsource-constructor-empty-url.any.js': {
58+
comment:
59+
'workerd throws SyntaxError for empty URL instead of resolving to self.location',
60+
expectedFailures: ['EventSource constructor with an empty url.'],
61+
},
62+
'eventsource-constructor-non-same-origin.window.js': {
63+
comment: 'Window-specific tests are not supported',
64+
omittedTests: true,
65+
},
66+
'eventsource-constructor-stringify.window.js': {
67+
comment: 'Window-specific tests are not supported',
68+
omittedTests: true,
69+
},
70+
'eventsource-constructor-url-bogus.any.js': {},
71+
'eventsource-cross-origin.window.js': {
72+
comment: 'Window-specific tests are not supported',
73+
omittedTests: true,
74+
},
75+
'eventsource-eventtarget.any.js': {
76+
comment: 'EventSource does not support relative URLs in workerd',
77+
expectedFailures: true,
78+
},
79+
'eventsource-onmessage-trusted.any.js': {
80+
comment: 'EventSource does not support relative URLs in workerd',
81+
expectedFailures: true,
82+
},
83+
'eventsource-onmessage.any.js': {
84+
comment: 'EventSource does not support relative URLs in workerd',
85+
expectedFailures: true,
86+
},
87+
'eventsource-onopen.any.js': {
88+
comment: 'EventSource does not support relative URLs in workerd',
89+
expectedFailures: true,
90+
},
91+
'eventsource-prototype.any.js': {
92+
comment: 'EventSource does not support relative URLs in workerd',
93+
expectedFailures: true,
94+
},
95+
'eventsource-reconnect.window.js': {
96+
comment: 'Window-specific tests are not supported',
97+
omittedTests: true,
98+
},
99+
'eventsource-request-cancellation.window.js': {
100+
comment: 'Window-specific tests are not supported',
101+
omittedTests: true,
102+
},
103+
'eventsource-url.any.js': {
104+
comment: 'EventSource does not support relative URLs in workerd',
105+
expectedFailures: true,
106+
},
107+
'format-bom-2.any.js': {
108+
comment: 'EventSource does not support relative URLs in workerd',
109+
expectedFailures: true,
110+
},
111+
'format-bom.any.js': {
112+
comment: 'EventSource does not support relative URLs in workerd',
113+
expectedFailures: true,
114+
},
115+
'format-comments.any.js': {
116+
comment: 'EventSource does not support relative URLs in workerd',
117+
expectedFailures: true,
118+
},
119+
'format-data-before-final-empty-line.any.js': {
120+
comment: 'EventSource does not support relative URLs in workerd',
121+
expectedFailures: true,
122+
},
123+
'format-field-data.any.js': {
124+
comment: 'EventSource does not support relative URLs in workerd',
125+
expectedFailures: true,
126+
},
127+
'format-field-event-empty.any.js': {
128+
comment: 'EventSource does not support relative URLs in workerd',
129+
expectedFailures: true,
130+
},
131+
'format-field-event.any.js': {
132+
comment: 'EventSource does not support relative URLs in workerd',
133+
expectedFailures: true,
134+
},
135+
'format-field-id-2.any.js': {
136+
comment: 'EventSource does not support relative URLs in workerd',
137+
expectedFailures: true,
138+
},
139+
'format-field-id-3.window.js': {
140+
comment: 'Window-specific tests are not supported',
141+
omittedTests: true,
142+
},
143+
'format-field-id-null.window.js': {
144+
comment: 'Window-specific tests are not supported',
145+
omittedTests: true,
146+
},
147+
'format-field-id.any.js': {
148+
comment: 'EventSource does not support relative URLs in workerd',
149+
expectedFailures: true,
150+
},
151+
'format-field-parsing.any.js': {
152+
comment: 'EventSource does not support relative URLs in workerd',
153+
expectedFailures: true,
154+
},
155+
'format-field-retry-bogus.any.js': {
156+
comment: 'EventSource does not support relative URLs in workerd',
157+
expectedFailures: true,
158+
},
159+
'format-field-retry-empty.any.js': {
160+
comment: 'EventSource does not support relative URLs in workerd',
161+
expectedFailures: true,
162+
},
163+
'format-field-retry.any.js': {
164+
comment: 'EventSource does not support relative URLs in workerd',
165+
expectedFailures: true,
166+
},
167+
'format-field-unknown.any.js': {
168+
comment: 'EventSource does not support relative URLs in workerd',
169+
expectedFailures: true,
170+
},
171+
'format-leading-space.any.js': {
172+
comment: 'EventSource does not support relative URLs in workerd',
173+
expectedFailures: true,
174+
},
175+
'format-mime-bogus.any.js': {
176+
comment: 'EventSource does not support relative URLs in workerd',
177+
expectedFailures: true,
178+
},
179+
'format-mime-trailing-semicolon.any.js': {
180+
comment: 'EventSource does not support relative URLs in workerd',
181+
expectedFailures: true,
182+
},
183+
'format-mime-valid-bogus.any.js': {
184+
comment: 'EventSource does not support relative URLs in workerd',
185+
expectedFailures: true,
186+
},
187+
'format-newlines.any.js': {
188+
comment: 'EventSource does not support relative URLs in workerd',
189+
expectedFailures: true,
190+
},
191+
'format-null-character.any.js': {
192+
comment: 'EventSource does not support relative URLs in workerd',
193+
expectedFailures: true,
194+
},
195+
'format-utf-8.any.js': {
196+
comment: 'EventSource does not support relative URLs in workerd',
197+
expectedFailures: true,
198+
},
199+
'request-accept.any.js': {
200+
comment: 'EventSource does not support relative URLs in workerd',
201+
expectedFailures: true,
202+
},
203+
'request-cache-control.any.js': {
204+
comment: 'Test times out due to relative URL handling',
205+
omittedTests: true,
206+
},
207+
'request-credentials.window.js': {
208+
comment: 'Window-specific tests are not supported',
209+
omittedTests: true,
210+
},
211+
'request-redirect.window.js': {
212+
comment: 'Window-specific tests are not supported',
213+
omittedTests: true,
214+
},
215+
'request-status-error.window.js': {
216+
comment: 'Window-specific tests are not supported',
217+
omittedTests: true,
218+
},
219+
'shared-worker/eventsource-close.js': {
220+
comment: 'SharedWorker tests are not applicable to workerd',
221+
omittedTests: true,
222+
},
223+
'shared-worker/eventsource-constructor-non-same-origin.js': {
224+
comment: 'SharedWorker tests are not applicable to workerd',
225+
omittedTests: true,
226+
},
227+
'shared-worker/eventsource-constructor-url-bogus.js': {
228+
comment: 'SharedWorker tests are not applicable to workerd',
229+
omittedTests: true,
230+
},
231+
'shared-worker/eventsource-eventtarget.js': {
232+
comment: 'SharedWorker tests are not applicable to workerd',
233+
omittedTests: true,
234+
},
235+
'shared-worker/eventsource-onmesage.js': {
236+
comment: 'SharedWorker tests are not applicable to workerd',
237+
omittedTests: true,
238+
},
239+
'shared-worker/eventsource-onopen.js': {
240+
comment: 'SharedWorker tests are not applicable to workerd',
241+
omittedTests: true,
242+
},
243+
'shared-worker/eventsource-prototype.js': {
244+
comment: 'SharedWorker tests are not applicable to workerd',
245+
omittedTests: true,
246+
},
247+
'shared-worker/eventsource-url.js': {
248+
comment: 'SharedWorker tests are not applicable to workerd',
249+
omittedTests: true,
250+
},
251+
} satisfies TestRunnerConfig;

0 commit comments

Comments
 (0)