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: re-enable conditional WPT Report for websockets #2406

Closed
wants to merge 1 commit into from
Closed
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
13 changes: 10 additions & 3 deletions test/wpt/start-websockets.mjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import { WPTRunner } from './runner/runner.mjs'
import { join } from 'path'
import { fileURLToPath } from 'url'
import { fork } from 'child_process'
import { fork, execSync } from 'child_process'
import { on } from 'events'
import { argv } from 'process'

const { WPT_REPORT } = process.env

function isExperimentalAvailable () {
console.log('execSync Result in CI', execSync(`${argv[0]} --expose-internals --print 'typeof require("internal/options").getOptionValue("--experimental-websocket") === "boolean"'`, { encoding: 'utf8' }))

return execSync(`${argv[0]} --expose-internals --print 'typeof require("internal/options").getOptionValue("--experimental-websocket") === "boolean"'`, { encoding: 'utf8' }) === 'true'
}

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

return process.execArgv.includes('--experimental-websocket')
return isExperimentalAvailable()
}

if (process.env.CI) {
Expand All @@ -30,7 +37,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 && isGlobalAvailable(),
appendReport: isGlobalAvailable() && !!WPT_REPORT,
reportPath: WPT_REPORT
})
runner.run()
Expand Down
Loading