MCPcopy Index your code
hub / github.com/code-pushup/cli / createRunnerFunction

Function createRunnerFunction

packages/plugin-coverage/src/lib/runner/runner.ts:12–52  ·  view source on GitHub ↗
(
  config: FinalCoveragePluginConfig,
)

Source from the content-addressed store, hash-verified

10import { lcovResultsToAuditOutputs } from './lcov/lcov-runner.js';
11
12export function createRunnerFunction(
13 config: FinalCoveragePluginConfig,
14): RunnerFunction {
15 return async () => {
16 const {
17 reports,
18 coverageToolCommand,
19 continueOnCommandFail,
20 coverageTypes,
21 } = config;
22
23 // Run coverage tool if provided
24 if (coverageToolCommand == null) {
25 logger.info(
26 'No test command provided, assuming coverage has already been collected',
27 );
28 } else {
29 logger.info('Executing test command to collect coverage ...');
30 const { command, args } = coverageToolCommand;
31 try {
32 await executeProcess({ command, args });
33 } catch {
34 if (!continueOnCommandFail) {
35 throw new Error(
36 'Running coverage tool failed. Make sure all your tests are passing.',
37 );
38 }
39 }
40 }
41
42 // Calculate coverage from LCOV results
43 const auditOutputs = await lcovResultsToAuditOutputs(
44 reports,
45 coverageTypes,
46 );
47
48 logAuditOutputs(auditOutputs);
49
50 return auditOutputs;
51 };
52}
53
54function logAuditOutputs(auditOutputs: AuditOutputs): void {
55 logger.info(

Callers

nothing calls this directly

Calls 4

executeProcessFunction · 0.90
logAuditOutputsFunction · 0.85
infoMethod · 0.80

Tested by

no test coverage detected