MCPcopy Create free account
hub / github.com/Snapchat/Valdi / valdiTest

Function valdiTest

npm_modules/cli/src/commands/test.ts:19–45  ·  view source on GitHub ↗
(argv: ArgumentsResolver<CommandParameters>)

Source from the content-addressed store, hash-verified

17}
18
19async function valdiTest(argv: ArgumentsResolver<CommandParameters>) {
20 const bazelClient = new BazelClient();
21
22 const targets = await argv.getArgumentOrResolve('target', () => {
23 return LoadingIndicator.fromTask(getTestTargetsByModuleNames(bazelClient, argv.getArgument('module') ?? []))
24 .setText(wrapInColor('Collecting targets for tests...', ANSI_COLORS.YELLOW_COLOR))
25 .setSuccessText(wrapInColor('Finished collecting test targets.', ANSI_COLORS.GREEN_COLOR))
26 .setFailureText(wrapInColor('Failed to collect targets.', ANSI_COLORS.RED_COLOR))
27 .show();
28 });
29
30 if (targets === undefined || targets.length === 0) {
31 console.log('No test targets found.');
32 return;
33 }
34
35 console.log('Starting tests for targets:');
36 console.log(
37 targets
38 .map(target => {
39 return ` ${wrapInColor(target, ANSI_COLORS.GREEN_COLOR)}`;
40 })
41 .join('\n'),
42 );
43
44 await bazelClient.testTargets(targets, argv.getArgument('bazel_args'));
45}
46
47export const command = 'test [--module module_name] [--target target_name]';
48export const describe =

Callers

nothing calls this directly

Calls 13

testTargetsMethod · 0.95
wrapInColorFunction · 0.90
getArgumentOrResolveMethod · 0.80
setFailureTextMethod · 0.80
setSuccessTextMethod · 0.80
fromTaskMethod · 0.80
showMethod · 0.65
logMethod · 0.65
setTextMethod · 0.45
getArgumentMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected