mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
chore(ext/node): run node compat parallel tests in core number concurrency (#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 #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.
42c4a35952/Makefile (L356)
This commit is contained in:
parent
d418f792a9
commit
3deade4b14
1 changed files with 10 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
import { magenta } from "std/fmt/colors.ts";
|
import { magenta } from "std/fmt/colors.ts";
|
||||||
|
import { pooledMap } from "std/async/pool.ts";
|
||||||
import { dirname, fromFileUrl, join } from "std/path/mod.ts";
|
import { dirname, fromFileUrl, join } from "std/path/mod.ts";
|
||||||
import { fail } from "std/testing/asserts.ts";
|
import { fail } from "std/testing/asserts.ts";
|
||||||
import {
|
import {
|
||||||
|
@ -115,11 +116,16 @@ Deno.test("Node.js compatibility", async (t) => {
|
||||||
for (const path of testPaths.sequential) {
|
for (const path of testPaths.sequential) {
|
||||||
await runTest(t, path);
|
await runTest(t, path);
|
||||||
}
|
}
|
||||||
const pending = [];
|
const testPool = pooledMap(
|
||||||
for (const path of testPaths.parallel) {
|
navigator.hardwareConcurrency,
|
||||||
pending.push(runTest(t, path));
|
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[]>) {
|
function checkConfigTestFilesOrder(testFileLists: Array<string[]>) {
|
||||||
|
|
Loading…
Reference in a new issue