From c0cf0414a055a6e7c9bd4911b975fc414633cc09 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Mon, 9 Dec 2024 17:37:53 -0800 Subject: [PATCH] Add helper for running node tests --- package.json | 3 ++- scripts/runner.node.mjs | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 65969f7ba8..07c30a8ccc 100644 --- a/package.json +++ b/package.json @@ -73,6 +73,7 @@ "prettier": "bun run analysis:no-llvm --target prettier", "prettier:check": "bun run analysis:no-llvm --target prettier-check", "prettier:extra": "bun run analysis:no-llvm --target prettier-extra", - "prettier:diff": "bun run analysis:no-llvm --target prettier-diff" + "prettier:diff": "bun run analysis:no-llvm --target prettier-diff", + "node:test": "node ./scripts/runner.node.mjs --exec-path=$npm_execpath --node-tests " } } diff --git a/scripts/runner.node.mjs b/scripts/runner.node.mjs index 3fa3eaa66a..9a9bc59256 100755 --- a/scripts/runner.node.mjs +++ b/scripts/runner.node.mjs @@ -52,6 +52,10 @@ const integrationTimeout = 5 * 60_000; const { values: options, positionals: filters } = parseArgs({ allowPositionals: true, options: { + ["node-tests"]: { + type: "boolean", + default: false, + }, ["exec-path"]: { type: "string", default: "bun", @@ -949,10 +953,14 @@ async function getVendorTests(cwd) { * @returns {string[]} */ function getRelevantTests(cwd) { - const tests = getTests(cwd); + let tests = getTests(cwd); const availableTests = []; const filteredTests = []; + if (options["node-tests"]) { + tests = tests.filter(testPath => testPath.includes("js/node/test/parallel/")); + } + const isMatch = (testPath, filter) => { return testPath.replace(/\\/g, "/").includes(filter); };