summaryrefslogtreecommitdiff
path: root/cli/tests/node_compat/common.ts
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2023-03-14 07:56:06 +0000
committerGitHub <noreply@github.com>2023-03-14 16:56:06 +0900
commitc47075ba4d83002ee36c3b2090f34f30bb28a7da (patch)
tree1ac60655c0ea16d41cc0e7caed616e637471121d /cli/tests/node_compat/common.ts
parente80cc17dc43c26fe9dd1d1fb0dce80fc049cfffd (diff)
test: parallelize applicable node compat tests (#18161)
Diffstat (limited to 'cli/tests/node_compat/common.ts')
-rw-r--r--cli/tests/node_compat/common.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/cli/tests/node_compat/common.ts b/cli/tests/node_compat/common.ts
index 72f44e510..0941e2c8f 100644
--- a/cli/tests/node_compat/common.ts
+++ b/cli/tests/node_compat/common.ts
@@ -1,4 +1,5 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+import { partition } from "std/collections/mod.ts";
import { join } from "std/path/mod.ts";
/**
@@ -52,3 +53,14 @@ export function getPathsFromTestSuites(suites: TestSuites): string[] {
}
return testPaths;
}
+
+const PARALLEL_PATTERN = Deno.build.os == "windows"
+ ? /^parallel[/\/]/
+ : /^parallel\//;
+
+export function partitionParallelTestPaths(
+ testPaths: string[],
+): { parallel: string[]; sequential: string[] } {
+ const partitions = partition(testPaths, (p) => !!p.match(PARALLEL_PATTERN));
+ return { parallel: partitions[0], sequential: partitions[1] };
+}