From 32d0a231ba3fb1c74c6fcbdb03452716a95161b3 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Tue, 7 Nov 2023 10:55:16 +0100 Subject: [PATCH] test: re-enable conditional WPT Report for websockets --- test/wpt/start-websockets.mjs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/wpt/start-websockets.mjs b/test/wpt/start-websockets.mjs index ee364ecf6c5..67a9ce5e019 100644 --- a/test/wpt/start-websockets.mjs +++ b/test/wpt/start-websockets.mjs @@ -1,17 +1,22 @@ 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 () { + 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) {