diff options
Diffstat (limited to 'cli/tests/node_compat/common.ts')
-rw-r--r-- | cli/tests/node_compat/common.ts | 12 |
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] }; +} |