mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-05-03 14:51:18 +01:00
Rename files
This commit is contained in:
29
ts/scripts/mocha-separator.node.ts
Normal file
29
ts/scripts/mocha-separator.node.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import { join } from 'node:path';
|
||||
|
||||
const MOCHA = join(__dirname, '..', '..', 'node_modules', '.bin', 'mocha');
|
||||
const WORKER_COUNT = parseInt(process.env.WORKER_COUNT || '1', 10);
|
||||
const WORKER_INDEX = parseInt(process.env.WORKER_INDEX || '0', 10);
|
||||
|
||||
const separator = process.argv.indexOf('--');
|
||||
if (separator === -1) {
|
||||
throw new Error('Expected `--` separator between options and files');
|
||||
}
|
||||
|
||||
const flags = process.argv.slice(2, separator);
|
||||
const files = process.argv.slice(separator + 1);
|
||||
|
||||
const filteredFiles = files.filter((_file, index) => {
|
||||
return index % WORKER_COUNT === WORKER_INDEX;
|
||||
});
|
||||
|
||||
console.log(`Running on ${filteredFiles.length}/${files.length} of files`);
|
||||
|
||||
const { status } = spawnSync(MOCHA, [...flags, ...filteredFiles], {
|
||||
stdio: 'inherit',
|
||||
});
|
||||
|
||||
process.exit(status);
|
||||
Reference in New Issue
Block a user