Skip to content

Commit 9782989

Browse files
committed
ci: fix coverage plugin for projects with missing int-test target
1 parent f05383d commit 9782989

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

code-pushup.preset.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* eslint-disable @nx/enforce-module-boundaries */
2+
import { createProjectGraphAsync } from '@nx/devkit';
23
import type {
34
CategoryConfig,
45
CoreConfig,
@@ -93,10 +94,15 @@ export async function configureCoveragePlugin(
9394
const config: CoveragePluginConfig = projectName
9495
? // We do not need to run a coverageToolCommand. This is handled over the Nx task graph.
9596
{
96-
reports: targets.map(target => ({
97-
pathToProject: `packages/${projectName}`,
98-
resultsPath: `coverage/${projectName}/${target}s/lcov.info`,
99-
})),
97+
reports: Object.keys(
98+
(await createProjectGraphAsync()).nodes[projectName]?.data.targets ??
99+
{},
100+
)
101+
.filter(target => targets.includes(target))
102+
.map(target => ({
103+
pathToProject: `packages/${projectName}`,
104+
resultsPath: `coverage/${projectName}/${target}s/lcov.info`,
105+
})),
100106
}
101107
: {
102108
reports: await getNxCoveragePaths(targets),

0 commit comments

Comments
 (0)