@tapjs/run
Version:
Command-line interface for the node-tap runner
37 lines • 1.1 kB
JavaScript
// some main stuff, mostly for the index runner, but also used
// in a few other places.
// Putting it here in this module prevents a cycle that makes it
// annoying to load units in the tests for this package.
import { TapConfig } from '@tapjs/config';
export const config = await TapConfig.load();
export const { values, positionals } = config.parse();
export let mainCommand = positionals[0] ||
(values.help ? 'help'
: values.version ? 'version'
: values.versions ? 'versions'
: 'run');
const commands = new Set([
'help',
'versions',
'version',
'run',
'build',
'report',
'plugin',
'list',
'repl',
'replay',
'config',
'debug',
'node-options',
]);
if (!commands.has(mainCommand)) {
mainCommand = 'run';
}
export const args = positionals.slice(positionals[0] === mainCommand ? 1 : 0);
if (mainCommand === 'version' || mainCommand === 'versions') {
args.length = 0;
args.push(mainCommand);
}
export const mainBin = String(new URL('index.js', import.meta.url));
//# sourceMappingURL=main-config.js.map