MCPcopy Create free account
hub / github.com/code-pushup/cli / readRunnerResults

Function readRunnerResults

packages/core/src/lib/implementation/runner.ts:136–156  ·  view source on GitHub ↗
(
  pluginSlug: string,
  outputDir: string,
)

Source from the content-addressed store, hash-verified

134}
135
136export async function readRunnerResults(
137 pluginSlug: string,
138 outputDir: string,
139): Promise<RunnerResult | null> {
140 const cachePath = getRunnerOutputsPath(pluginSlug, outputDir);
141 if (await fileExists(cachePath)) {
142 const cachedResult = await readJsonFile<AuditOutputs>(cachePath);
143 logger.info(
144 `Read runner output from cache ${formatCachePathSuffix(cachePath)}`,
145 );
146 return {
147 audits: cachedResult,
148 duration: 0,
149 date: new Date().toISOString(),
150 };
151 }
152 logger.info(
153 `Cached runner output is not available ${formatCachePathSuffix(cachePath)}`,
154 );
155 return null;
156}
157
158function formatCachePathSuffix(cacheFilePath: string): string {
159 return ansis.gray(`(${cacheFilePath})`);

Callers 2

executePluginFunction · 0.85
runner.int.test.tsFile · 0.85

Calls 4

fileExistsFunction · 0.90
getRunnerOutputsPathFunction · 0.85
formatCachePathSuffixFunction · 0.85
infoMethod · 0.80

Tested by

no test coverage detected