Skip to content

Commit

Permalink
chore(ext/node): run node compat parallel tests in core number concur…
Browse files Browse the repository at this point in the history
…rency (denoland#18505)

We currently run the all test cases in `parallel` category at the same
time, which invokes hundreds process at the same time, and that seems
causing some flakiness in CI. (maybe related to denoland#18487)

This PR limits the concurrency to the number of cpu cores. This is more
aligned to how Node.js run their `parallel` test in their repository.
https://github.com/nodejs/node/blob/42c4a359525f70c322c0df0eac188fa2b05c3f53/Makefile#L356
  • Loading branch information
kt3k committed Mar 30, 2023
1 parent d418f79 commit 3deade4
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions cli/tests/node_compat/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
import { magenta } from "std/fmt/colors.ts";
import { pooledMap } from "std/async/pool.ts";
import { dirname, fromFileUrl, join } from "std/path/mod.ts";
import { fail } from "std/testing/asserts.ts";
import {
Expand Down Expand Up @@ -115,11 +116,16 @@ Deno.test("Node.js compatibility", async (t) => {
for (const path of testPaths.sequential) {
await runTest(t, path);
}
const pending = [];
for (const path of testPaths.parallel) {
pending.push(runTest(t, path));
const testPool = pooledMap(
navigator.hardwareConcurrency,
testPaths.parallel,
(path) => runTest(t, path),
);
const testCases = [];
for await (const testCase of testPool) {
testCases.push(testCase);
}
await Promise.all(pending);
await Promise.all(testCases);
});

function checkConfigTestFilesOrder(testFileLists: Array<string[]>) {
Expand Down

0 comments on commit 3deade4

Please sign in to comment.