All files / scripts/bin pedalboard-scripts.js

100% Statements 15/15
100% Branches 2/2
100% Functions 1/1
100% Lines 15/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40                  1x 1x 1x 1x       3x   1x 1x   1x 1x     3x     1x 1x 1x   1x   1x          
#!/usr/bin/env node
 
/**
 * Copyright (c) 2021-present, Matti Bar-Zeev.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
 
const {fork} = require('child_process');
const path = require('path');
const AGGREGATE_PACKAGES_COVERAGE_COMMAND = 'aggregatePackagesCoverage';
const COLLECT_FILES = 'collectFiles';
 
function execute({command, commandArgs}) {
    let scriptPath;
    switch (command) {
        case AGGREGATE_PACKAGES_COVERAGE_COMMAND:
            scriptPath = path.resolve(__dirname, '../src/aggregate-packages-coverage.js');
            break;
        case COLLECT_FILES:
            scriptPath = path.resolve(__dirname, '../src/collect-files.js');
            break;
    }
 
    fork(scriptPath, commandArgs);
}
 
const args = process.argv.slice(2);
const command = args[0];
const commandArgs = args.slice(1);
 
execute({command, commandArgs});
 
module.exports = {
    execute,
    AGGREGATE_PACKAGES_COVERAGE_COMMAND,
    COLLECT_FILES,
};