mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 20:26:08 +00:00
[engineering] add testSplit option to unit-test runner (#253049)
helpful to run tests in parallel
This commit is contained in:
@@ -171,7 +171,14 @@ async function loadTestModules(opts) {
|
||||
|
||||
const pattern = opts.runGlob || _tests_glob;
|
||||
const files = await globAsync(pattern, { cwd: loadFn._out });
|
||||
const modules = files.map(file => file.replace(/\.js$/, ''));
|
||||
let modules = files.map(file => file.replace(/\.js$/, ''));
|
||||
if (opts.testSplit) {
|
||||
const [i, n] = opts.testSplit.split('/').map(Number);
|
||||
const chunkSize = Math.floor(modules.length / n);
|
||||
const start = (i - 1) * chunkSize;
|
||||
const end = i === n ? modules.length : i * chunkSize;
|
||||
modules = modules.slice(start, end);
|
||||
}
|
||||
return loadModules(modules);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user