Skip to content

Commit 54da005

Browse files
ASAS
authored andcommitted
Merge branch 'main' into plugin-coverage-test-improvements
2 parents c65bca0 + 2ae961a commit 54da005

File tree

113 files changed

+2411
-1200
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+2411
-1200
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,5 +139,7 @@ jobs:
139139
uses: nrwl/nx-set-shas@v4
140140
- name: Install dependencies
141141
run: npm ci
142-
- name: Build affected projects
143-
run: npx nx affected:build --parallel=3
142+
- name: Build all projects # affected is not used to be able to test-releae packages
143+
run: npx nx run-many --target=build --parallel=3
144+
- name: Test-release packages
145+
run: npx pkg-pr-new publish "packages/**/dist"

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
## 0.74.0 (2025-08-13)
2+
3+
### 🚀 Features
4+
5+
- add audit output caching for execute plugin ([#1057](https://github.com/code-pushup/cli/pull/1057))
6+
- add report option to cli ([#1058](https://github.com/code-pushup/cli/pull/1058))
7+
- add caching options to cli ([#1059](https://github.com/code-pushup/cli/pull/1059))
8+
9+
### ❤️ Thank You
10+
11+
- Michael Hladky @BioPhoton
12+
13+
## 0.73.0 (2025-08-08)
14+
15+
### 🚀 Features
16+
17+
- **ci:** add searchCommits option to extend portal cache range ([0b14111f](https://github.com/code-pushup/cli/commit/0b14111f))
18+
19+
### ❤️ Thank You
20+
21+
- Matěj Chalk
22+
123
## 0.72.1 (2025-08-06)
224

325
### 🩹 Fixes

code-pushup.preset.ts

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ import eslintPlugin, {
1111
eslintConfigFromNxProject,
1212
} from './packages/plugin-eslint/src/index.js';
1313
import jsPackagesPlugin from './packages/plugin-js-packages/src/index.js';
14-
import jsDocsPlugin, {
15-
JsDocsPluginConfig,
16-
} from './packages/plugin-jsdocs/src/index.js';
14+
import jsDocsPlugin from './packages/plugin-jsdocs/src/index.js';
15+
import type { JsDocsPluginTransformedConfig } from './packages/plugin-jsdocs/src/lib/config.js';
1716
import {
1817
PLUGIN_SLUG,
1918
groups,
@@ -98,7 +97,7 @@ export const eslintCategories: CategoryConfig[] = [
9897
];
9998

10099
export function getJsDocsCategories(
101-
config: JsDocsPluginConfig,
100+
config: JsDocsPluginTransformedConfig,
102101
): CategoryConfig[] {
103102
return [
104103
{
@@ -147,7 +146,7 @@ export const lighthouseCoreConfig = async (
147146
};
148147

149148
export const jsDocsCoreConfig = (
150-
config: JsDocsPluginConfig | string[],
149+
config: JsDocsPluginTransformedConfig | string[],
151150
): CoreConfig => ({
152151
plugins: [
153152
jsDocsPlugin(Array.isArray(config) ? { patterns: config } : config),
@@ -180,28 +179,25 @@ export const typescriptPluginConfig = async (
180179
export const coverageCoreConfigNx = async (
181180
projectName?: string,
182181
): Promise<CoreConfig> => {
183-
if (projectName) {
184-
throw new Error('coverageCoreConfigNx for single projects not implemented');
185-
}
186182
const targetNames = ['unit-test', 'int-test'];
187-
const targetArgs = [
188-
'-t',
189-
...targetNames,
190-
'--coverage.enabled',
191-
'--skipNxCache',
192-
];
183+
const targetArgs = ['-t', ...targetNames];
193184
return {
194185
plugins: [
195186
await coveragePlugin({
196187
coverageToolCommand: {
197188
command: 'npx',
198-
args: [
199-
'nx',
200-
projectName ? `run --project ${projectName}` : 'run-many',
201-
...targetArgs,
202-
],
189+
args: projectName
190+
? ['nx', 'run-many', '-p', projectName, ...targetArgs]
191+
: ['nx', 'run-many', ...targetArgs],
203192
},
204-
reports: await getNxCoveragePaths(targetNames),
193+
reports: projectName
194+
? [
195+
{
196+
pathToProject: `packages/${projectName}`,
197+
resultsPath: `packages/${projectName}/coverage/lcov.info`,
198+
},
199+
]
200+
: await getNxCoveragePaths(targetNames),
205201
}),
206202
],
207203
categories: coverageCategories,

e2e/ci-e2e/project.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@
44
"sourceRoot": "e2e/ci-e2e/src",
55
"projectType": "application",
66
"targets": {
7-
"lint": {
8-
"executor": "@nx/linter:eslint",
9-
"outputs": ["{options.outputFile}"],
10-
"options": {
11-
"lintFilePatterns": ["e2e/ci-e2e/**/*.ts"]
12-
}
13-
},
7+
"lint": {},
148
"e2e": {
159
"executor": "@nx/vite:test",
1610
"options": {
17-
"configFile": "e2e/ci-e2e/vitest.e2e.config.ts"
11+
"configFile": "{projectRoot}/vitest.e2e.config.ts"
1812
}
1913
}
2014
},

e2e/cli-e2e/project.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@
44
"sourceRoot": "e2e/cli-e2e/src",
55
"projectType": "application",
66
"targets": {
7-
"lint": {
8-
"executor": "@nx/linter:eslint",
9-
"outputs": ["{options.outputFile}"],
10-
"options": {
11-
"lintFilePatterns": ["e2e/cli-e2e/**/*.ts"]
12-
}
13-
},
7+
"lint": {},
148
"e2e": {
159
"executor": "@nx/vite:test",
1610
"options": {
17-
"configFile": "e2e/cli-e2e/vitest.e2e.config.ts"
11+
"configFile": "{projectRoot}/vitest.e2e.config.ts"
1812
}
1913
}
2014
},

e2e/cli-e2e/tests/__snapshots__/help.e2e.test.ts.snap

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,23 @@ Global Options:
3636
-p, --onlyPlugins List of plugins to run. If not set all plugins are run.
3737
[array] [default: []]
3838
39+
Cache Options:
40+
--cache Cache runner outputs (both read and write)
41+
[boolean]
42+
--cache.read Read runner-output.json from file system
43+
[boolean]
44+
--cache.write Write runner-output.json to file system
45+
[boolean]
46+
3947
Persist Options:
40-
--persist.outputDir Directory for the produced reports
48+
--persist.outputDir Directory for the produced reports
4149
[string]
42-
--persist.filename Filename for the produced reports.
50+
--persist.filename Filename for the produced reports.
4351
[string]
44-
--persist.format Format of the report output. e.g. \`md\`, \`json\`
52+
--persist.format Format of the report output. e.g. \`md\`, \`json\`
4553
[array]
54+
--persist.skipReports Skip generating report files. (useful in combinatio
55+
n with caching) [boolean]
4656
4757
Upload Options:
4858
--upload.organization Organization slug from portal

e2e/cli-e2e/tests/collect.e2e.test.ts

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,13 @@ import {
77
TEST_OUTPUT_DIR,
88
teardownTestFolder,
99
} from '@code-pushup/test-utils';
10-
import { executeProcess, readTextFile } from '@code-pushup/utils';
10+
import {
11+
executeProcess,
12+
fileExists,
13+
readJsonFile,
14+
readTextFile,
15+
} from '@code-pushup/utils';
16+
import { dummyPluginSlug } from '../mocks/fixtures/dummy-setup/dummy.plugin';
1117

1218
describe('CLI collect', () => {
1319
const dummyPluginTitle = 'Dummy Plugin';
@@ -61,6 +67,50 @@ describe('CLI collect', () => {
6167
expect(md).toContain(dummyAuditTitle);
6268
});
6369

70+
it('should write runner outputs if --cache is given', async () => {
71+
const { code } = await executeProcess({
72+
command: 'npx',
73+
args: ['@code-pushup/cli', '--no-progress', 'collect', '--cache'],
74+
cwd: dummyDir,
75+
});
76+
77+
expect(code).toBe(0);
78+
79+
await expect(
80+
readJsonFile(
81+
path.join(dummyOutputDir, dummyPluginSlug, 'runner-output.json'),
82+
),
83+
).resolves.toStrictEqual([
84+
{
85+
slug: 'dummy-audit',
86+
score: 0.3,
87+
value: 3,
88+
},
89+
]);
90+
});
91+
92+
it('should not create reports if --persist.skipReports is given', async () => {
93+
const { code } = await executeProcess({
94+
command: 'npx',
95+
args: [
96+
'@code-pushup/cli',
97+
'--no-progress',
98+
'collect',
99+
'--persist.skipReports',
100+
],
101+
cwd: dummyDir,
102+
});
103+
104+
expect(code).toBe(0);
105+
106+
await expect(
107+
fileExists(path.join(dummyOutputDir, 'report.md')),
108+
).resolves.toBeFalsy();
109+
await expect(
110+
fileExists(path.join(dummyOutputDir, 'report.json')),
111+
).resolves.toBeFalsy();
112+
});
113+
64114
it('should print report summary to stdout', async () => {
65115
const { code, stdout } = await executeProcess({
66116
command: 'npx',

e2e/create-cli-e2e/project.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,12 @@
44
"sourceRoot": "examples/create-cli-e2e/src",
55
"projectType": "application",
66
"targets": {
7-
"lint": {
8-
"executor": "@nx/linter:eslint",
9-
"outputs": ["{options.outputFile}"],
10-
"options": {
11-
"lintFilePatterns": ["e2e/create-cli-e2e/**/*.ts"]
12-
}
13-
},
7+
"lint": {},
148
"e2e": {
159
"executor": "@nx/vite:test",
1610
"options": {
1711
"keepServerRunning": true,
18-
"configFile": "e2e/create-cli-e2e/vitest.e2e.config.ts"
12+
"configFile": "{projectRoot}/vitest.e2e.config.ts"
1913
}
2014
}
2115
},

e2e/nx-plugin-e2e/project.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@
44
"sourceRoot": "e2e/nx-plugin-e2e/src",
55
"projectType": "application",
66
"targets": {
7-
"lint": {
8-
"executor": "@nx/linter:eslint",
9-
"outputs": ["{options.outputFile}"],
10-
"options": {
11-
"lintFilePatterns": ["e2e/nx-plugin-e2e/**/*.ts"]
12-
}
13-
},
7+
"lint": {},
148
"e2e": {
159
"executor": "@nx/vite:test",
1610
"options": {
17-
"configFile": "e2e/nx-plugin-e2e/vitest.e2e.config.ts"
11+
"configFile": "{projectRoot}/vitest.e2e.config.ts"
1812
}
1913
}
2014
},

e2e/plugin-coverage-e2e/project.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,11 @@
44
"sourceRoot": "e2e/plugin-coverage-e2e/src",
55
"projectType": "application",
66
"targets": {
7-
"lint": {
8-
"executor": "@nx/linter:eslint",
9-
"outputs": ["{options.outputFile}"],
10-
"options": {
11-
"lintFilePatterns": ["e2e/plugin-coverage-e2e/**/*.ts"]
12-
}
13-
},
7+
"lint": {},
148
"e2e": {
159
"executor": "@nx/vite:test",
1610
"options": {
17-
"configFile": "e2e/plugin-coverage-e2e/vitest.e2e.config.ts"
11+
"configFile": "{projectRoot}/vitest.e2e.config.ts"
1812
}
1913
}
2014
},

0 commit comments

Comments
 (0)