Skip to content

Commit

Permalink
fix: node parallel test check in test runner (#16232)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonIsaac authored Jan 8, 2025
1 parent 84cf40b commit fd5d8ad
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions scripts/runner.node.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ async function runTests() {
if (!failedResults.length) {
for (const testPath of tests) {
const title = relative(cwd, join(testsPath, testPath)).replace(/\\/g, "/");
if (title.startsWith("test/js/node/test/parallel/")) {
if (isNodeParallelTest(testPath)) {
await runTest(title, async () => {
const { ok, error, stdout } = await spawnBun(execPath, {
cwd: cwd,
Expand Down Expand Up @@ -850,12 +850,20 @@ function isJavaScriptTest(path) {
return isJavaScript(path) && /\.test|spec\./.test(basename(path));
}

/**
* @param {string} testPath
* @returns {boolean}
*/
function isNodeParallelTest(testPath) {
return testPath.replaceAll(sep, "/").includes("js/node/test/parallel/")
}

/**
* @param {string} path
* @returns {boolean}
*/
function isTest(path) {
if (path.replaceAll(sep, "/").startsWith("js/node/test/parallel/") && targetDoesRunNodeTests()) return true;
if (isNodeParallelTest(path) && targetDoesRunNodeTests()) return true;
if (path.replaceAll(sep, "/").startsWith("js/node/cluster/test-") && path.endsWith(".ts")) return true;
return isTestStrict(path);
}
Expand Down Expand Up @@ -1035,7 +1043,7 @@ function getRelevantTests(cwd) {
const filteredTests = [];

if (options["node-tests"]) {
tests = tests.filter(testPath => testPath.includes("js/node/test/parallel/"));
tests = tests.filter(isNodeParallelTest);
}

const isMatch = (testPath, filter) => {
Expand Down

0 comments on commit fd5d8ad

Please sign in to comment.