From fe485c08d76917d8bf0d58a3f58c7713472408c0 Mon Sep 17 00:00:00 2001 From: Keith Miller Date: Fri, 19 Dec 2025 15:01:29 -0500 Subject: [PATCH 1/2] Add verbose option to the node server. This is somewhat handy when checking if network requests happen during the benchmark run itself. I clear the screen then click start and if any resources are fetched logging will be printed to the terminal session. It doesn't catch network requests but those are more obvious during development. For posterity, after a bit of debugging I realized that you have to pass options as `npm run server -- --verbose` rather than `npm run server --verbose` --- tests/server.mjs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tests/server.mjs b/tests/server.mjs index 0b86ac96..a04ed6b2 100644 --- a/tests/server.mjs +++ b/tests/server.mjs @@ -29,14 +29,21 @@ import LocalWebServer from "local-web-server"; const ROOT_DIR = path.join(process.cwd(), "./"); -export default async function serve(port) { +const optionDefinitions = [ + { name: "port", type: Number, defaultValue: 8010, description: "Set the test-server port, The default value is 8010." }, + { name: "verbose", type: Boolean, defaultValue: false, description: "Log all requests set to the server." }, +]; + +export default async function serve({ port, verbose }) { if (!port) throw new Error("Port is required"); + const ws = await LocalWebServer.create({ port: port, directory: ROOT_DIR, corsOpenerPolicy: "same-origin", corsEmbedderPolicy: "require-corp", + logFormat: verbose ? "dev" : "none", }); console.log(`Server started on http://localhost:${port}`); process.on("exit", () => ws.server.close()); @@ -48,11 +55,8 @@ export default async function serve(port) { } function main() { - const optionDefinitions = [ - { name: "port", type: Number, defaultValue: 8010, description: "Set the test-server port, The default value is 8010." }, - ]; const options = commandLineArgs(optionDefinitions); - serve(options.port); + serve(options); } if (esMain(import.meta)) From 8c526422cda8ed40e4fe07073aaa8fbd1632b0a2 Mon Sep 17 00:00:00 2001 From: Keith Miller Date: Tue, 6 Jan 2026 10:12:35 -0500 Subject: [PATCH 2/2] Fix tests/run-browser.mjs for new argument format --- tests/run-browser.mjs | 6 +++--- tests/server.mjs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/run-browser.mjs b/tests/run-browser.mjs index 44cc825a..d5917b2c 100644 --- a/tests/run-browser.mjs +++ b/tests/run-browser.mjs @@ -24,7 +24,7 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF // THE POSSIBILITY OF SUCH DAMAGE. -import serve from "./server.mjs"; +import { serve, optionDefinitions as serverOptionDefinitions } from "./server.mjs"; import { Builder, Capabilities, logging } from "selenium-webdriver"; import { Options as ChromeOptions } from "selenium-webdriver/chrome.js"; import { Options as FirefoxOptions } from "selenium-webdriver/firefox.js"; @@ -80,8 +80,8 @@ function sleep(ms) { } const optionDefinitions = [ + ...serverOptionDefinitions, { name: "browser", type: String, description: "Set the browser to test, choices are [safari, firefox, chrome, edge]. By default the $BROWSER env variable is used." }, - { name: "port", type: Number, defaultValue: 8010, description: "Set the test-server port, The default value is 8010." }, { name: "help", alias: "h", description: "Print this help text." }, { name: "suite", type: String, defaultOption: true, typeLabel: `{underline choices}: ${VALID_TAGS.join(", ")}`, description: "Run a specific suite by name." } ]; @@ -142,7 +142,7 @@ process.once("uncaughtException", (err) => { }); const PORT = options.port; -const server = await serve(PORT); +const server = await serve(options); async function runTests() { let success = true; diff --git a/tests/server.mjs b/tests/server.mjs index a04ed6b2..a2642466 100644 --- a/tests/server.mjs +++ b/tests/server.mjs @@ -29,12 +29,12 @@ import LocalWebServer from "local-web-server"; const ROOT_DIR = path.join(process.cwd(), "./"); -const optionDefinitions = [ +export const optionDefinitions = [ { name: "port", type: Number, defaultValue: 8010, description: "Set the test-server port, The default value is 8010." }, { name: "verbose", type: Boolean, defaultValue: false, description: "Log all requests set to the server." }, ]; -export default async function serve({ port, verbose }) { +export async function serve({ port, verbose }) { if (!port) throw new Error("Port is required");