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

test: only include WebSocket in WPT Report where it's landed #2351

Merged
merged 1 commit into from
Oct 17, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"test:tdd": "tap test/*.js test/diagnostics-channel/*.js -w",
"test:typescript": "node scripts/verifyVersion.js 14 || tsd && tsc --skipLibCheck test/imports/undici-import.ts",
"test:websocket": "node scripts/verifyVersion.js 18 || tap test/websocket/*.js",
"test:wpt": "node scripts/verifyVersion 18 || (node test/wpt/start-fetch.mjs && node test/wpt/start-FileAPI.mjs && node test/wpt/start-mimesniff.mjs && node test/wpt/start-xhr.mjs && node --no-warnings test/wpt/start-websockets.mjs)",
"test:wpt": "node scripts/verifyVersion 18 || (node test/wpt/start-fetch.mjs && node test/wpt/start-FileAPI.mjs && node test/wpt/start-mimesniff.mjs && node test/wpt/start-xhr.mjs && node --no-warnings --expose-internals test/wpt/start-websockets.mjs)",
"coverage": "nyc --reporter=text --reporter=html npm run test",
"coverage:ci": "nyc --reporter=lcov npm run test",
"bench": "PORT=3042 concurrently -k -s first npm:bench:server npm:bench:run",
Expand Down
11 changes: 10 additions & 1 deletion test/wpt/start-websockets.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,18 @@ import { join } from 'path'
import { fileURLToPath } from 'url'
import { fork } from 'child_process'
import { on } from 'events'
import options from 'internal/options'

const { WPT_REPORT } = process.env

function isGlobalAvailable () {
if (typeof WebSocket !== 'undefined') {
return true
}

return typeof options.getOptionValue('--experimental-websocket') === 'boolean'
}

if (process.env.CI) {
// TODO(@KhafraDev): figure out *why* these tests are flaky in the CI.
// process.exit(0)
Expand All @@ -22,7 +31,7 @@ child.on('exit', (code) => process.exit(code))
for await (const [message] of on(child, 'message')) {
if (message.server) {
const runner = new WPTRunner('websockets', message.server, {
appendReport: !!WPT_REPORT,
appendReport: !!WPT_REPORT && isGlobalAvailable(),
reportPath: WPT_REPORT
})
runner.run()
Expand Down