Skip to content

Commit f0680e2

Browse files
author
John Doe
committed
Merge remote-tracking branch 'refs/remotes/origin/main' into refactor/utils/command-helper
# Conflicts: # packages/nx-plugin/src/executors/cli/executor.int.test.ts # packages/nx-plugin/src/internal/execute-process.ts # packages/utils/src/lib/execute-process.ts
2 parents 37f2028 + 9876d94 commit f0680e2

File tree

210 files changed

+2945
-2312
lines changed

Some content is hidden

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

210 files changed

+2945
-2312
lines changed

.github/actions/code-pushup/src/runner.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
type SourceFileIssue,
1111
runInCI,
1212
} from '@code-pushup/ci';
13-
import { CODE_PUSHUP_UNICODE_LOGO } from '@code-pushup/utils';
13+
import { CODE_PUSHUP_UNICODE_LOGO, stringifyError } from '@code-pushup/utils';
1414

1515
type GitHubRefs = {
1616
head: GitBranch;
@@ -150,7 +150,7 @@ async function run(): Promise<void> {
150150

151151
core.info(`${LOG_PREFIX} Finished running successfully`);
152152
} catch (error) {
153-
const message = error instanceof Error ? error.message : String(error);
153+
const message = stringifyError(error);
154154
core.error(`${LOG_PREFIX} Failed: ${message}`);
155155
core.setFailed(message);
156156
}

CHANGELOG.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,60 @@
1+
## 0.85.0 (2025-11-07)
2+
3+
### 🚀 Features
4+
5+
- **utils:** print custom cwd in logger command spinner ([52dc118c](https://github.com/code-pushup/cli/commit/52dc118c))
6+
- **utils:** integrate logger with executeProcess ([eb04da8f](https://github.com/code-pushup/cli/commit/eb04da8f))
7+
8+
### 🩹 Fixes
9+
10+
- **ci:** remove redundant silent and debug options, use CP_VERBOSE env ([62a48b01](https://github.com/code-pushup/cli/commit/62a48b01))
11+
- **ci,core,nx-plugin,create-cli:** prevent duplicate process logs ([edfd95d5](https://github.com/code-pushup/cli/commit/edfd95d5))
12+
- **plugin-js-packages:** avoid parallel process execution (concurrent spinners not supported) ([455043e3](https://github.com/code-pushup/cli/commit/455043e3))
13+
- **utils:** hide verbose stdout/stderr attributes in ProcessError object ([7b9b6a94](https://github.com/code-pushup/cli/commit/7b9b6a94))
14+
15+
### ❤️ Thank You
16+
17+
- Matěj Chalk
18+
19+
## 0.84.0 (2025-10-30)
20+
21+
### 🚀 Features
22+
23+
- **ci:** use new shared logger, remove option ([6f134e62](https://github.com/code-pushup/cli/commit/6f134e62))
24+
25+
### ❤️ Thank You
26+
27+
- Matěj Chalk
28+
29+
## 0.83.0 (2025-10-29)
30+
31+
### 🚀 Features
32+
33+
- use formatted zod schema validation errors ([68fe123d](https://github.com/code-pushup/cli/commit/68fe123d))
34+
- **plugin-lighthouse:** prettify table validation errors ([ab2fe542](https://github.com/code-pushup/cli/commit/ab2fe542))
35+
- **utils:** prettify zod errors in stringifyError utility ([5e7456f7](https://github.com/code-pushup/cli/commit/5e7456f7))
36+
- **utils:** add option to truncate error messages to one-liner ([487ac865](https://github.com/code-pushup/cli/commit/487ac865))
37+
- **utils:** truncate group/spinner inline errors to one-liner ([ee31b9e8](https://github.com/code-pushup/cli/commit/ee31b9e8))
38+
- **utils:** provide validateAsync alternative to synchronous validate ([fb236e19](https://github.com/code-pushup/cli/commit/fb236e19))
39+
40+
### 🩹 Fixes
41+
42+
- use safe error to string conversions ([c78c7264](https://github.com/code-pushup/cli/commit/c78c7264))
43+
44+
### ❤️ Thank You
45+
46+
- Matěj Chalk
47+
48+
## 0.82.0 (2025-10-25)
49+
50+
### 🚀 Features
51+
52+
- **nx-plugin:** adjust bin path handling ([#1109](https://github.com/code-pushup/cli/pull/1109))
53+
54+
### ❤️ Thank You
55+
56+
- Michael Hladky @BioPhoton
57+
158
## 0.81.0 (2025-10-22)
259

360
### 🚀 Features

e2e/ci-e2e/global-setup.ts

Lines changed: 0 additions & 16 deletions
This file was deleted.

e2e/ci-e2e/tsconfig.test.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
"vitest.e2e.config.ts",
99
"tests/**/*.e2e.test.ts",
1010
"tests/**/*.d.ts",
11-
"mocks/**/*.ts",
12-
"global-setup.ts"
11+
"mocks/**/*.ts"
1312
]
1413
}

e2e/ci-e2e/vitest.e2e.config.ts

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
1-
/// <reference types="vitest" />
2-
import { defineConfig } from 'vite';
3-
import { tsconfigPathAliases } from '../../tools/vitest-tsconfig-path-aliases.js';
1+
import { createE2ETestConfig } from '../../testing/test-setup-config/src/index.js';
42

5-
export default defineConfig({
6-
cacheDir: '../../node_modules/.vite/ci-e2e',
7-
test: {
8-
reporters: ['basic'],
9-
testTimeout: 60_000,
10-
globals: true,
11-
alias: tsconfigPathAliases(),
12-
pool: 'threads',
13-
poolOptions: { threads: { singleThread: true } },
14-
cache: {
15-
dir: '../../node_modules/.vitest',
16-
},
17-
environment: 'node',
18-
include: ['tests/**/*.e2e.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
19-
globalSetup: './global-setup.ts',
20-
setupFiles: ['../../testing/test-setup/src/lib/reset.mocks.ts'],
21-
},
3+
export default createE2ETestConfig('ci-e2e', {
4+
testTimeout: 60_000,
225
});

e2e/cli-e2e/vitest.e2e.config.ts

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
1-
/// <reference types="vitest" />
2-
import { defineConfig } from 'vite';
3-
import { tsconfigPathAliases } from '../../tools/vitest-tsconfig-path-aliases.js';
1+
import { createE2ETestConfig } from '../../testing/test-setup-config/src/index.js';
42

5-
export default defineConfig({
6-
cacheDir: '../../node_modules/.vite/cli-e2e',
7-
test: {
8-
reporters: ['basic'],
9-
testTimeout: 20_000,
10-
globals: true,
11-
alias: tsconfigPathAliases(),
12-
pool: 'threads',
13-
poolOptions: { threads: { singleThread: true } },
14-
cache: {
15-
dir: '../../node_modules/.vitest',
16-
},
17-
environment: 'node',
18-
include: ['tests/**/*.e2e.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
19-
setupFiles: ['../../testing/test-setup/src/lib/reset.mocks.ts'],
20-
},
3+
export default createE2ETestConfig('cli-e2e', {
4+
testTimeout: 20_000,
215
});
Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
1-
/// <reference types="vitest" />
2-
import { defineConfig } from 'vite';
3-
import { tsconfigPathAliases } from '../../tools/vitest-tsconfig-path-aliases.js';
1+
import { createE2ETestConfig } from '../../testing/test-setup-config/src/index.js';
42

5-
export default defineConfig({
6-
cacheDir: '../../node_modules/.vite/create-cli-e2e',
7-
test: {
8-
reporters: ['basic'],
9-
testTimeout: 20_000,
10-
hookTimeout: 20_000,
11-
globals: true,
12-
alias: tsconfigPathAliases(),
13-
pool: 'threads',
14-
poolOptions: { threads: { singleThread: true } },
15-
cache: {
16-
dir: '../../node_modules/.vitest',
17-
},
18-
environment: 'node',
19-
include: ['tests/**/*.e2e.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
20-
setupFiles: ['../../testing/test-setup/src/lib/reset.mocks.ts'],
21-
},
3+
export default createE2ETestConfig('create-cli-e2e', {
4+
testTimeout: 20_000,
225
});

e2e/nx-plugin-e2e/tests/executor-cli.e2e.test.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { type Tree, updateProjectConfiguration } from '@nx/devkit';
22
import path from 'node:path';
33
import { readProjectConfiguration } from 'nx/src/generators/utils/project-configuration';
4-
import { afterAll, afterEach, beforeEach, expect, vi } from 'vitest';
4+
import { afterAll, afterEach, beforeEach, expect } from 'vitest';
55
import {
66
type AutorunCommandExecutorOptions,
77
generateCodePushupConfig,
@@ -17,7 +17,7 @@ import {
1717
removeColorCodes,
1818
teardownTestFolder,
1919
} from '@code-pushup/test-utils';
20-
import { executeProcess, readJsonFile } from '@code-pushup/utils';
20+
import { executeProcess, logger, readJsonFile } from '@code-pushup/utils';
2121
import { INLINE_PLUGIN } from '../mocks/inline-plugin.js';
2222

2323
async function addTargetToWorkspace(
@@ -62,15 +62,16 @@ describe('executor command', () => {
6262
Object.entries(process.env).filter(([k]) => k.startsWith('CP_')),
6363
);
6464

65-
/* eslint-disable functional/immutable-data, @typescript-eslint/no-dynamic-delete */
6665
beforeAll(() => {
6766
Object.entries(process.env)
6867
.filter(([k]) => k.startsWith('CP_'))
69-
.forEach(([k]) => delete process.env[k]);
68+
.forEach(([k]) => {
69+
// eslint-disable-next-line functional/immutable-data, @typescript-eslint/no-dynamic-delete
70+
delete process.env[k];
71+
});
7072
});
7173

7274
beforeEach(async () => {
73-
vi.unstubAllEnvs();
7475
tree = await generateWorkspaceAndProject(project);
7576
});
7677

@@ -79,9 +80,11 @@ describe('executor command', () => {
7980
});
8081

8182
afterAll(() => {
82-
Object.entries(processEnvCP).forEach(([k, v]) => (process.env[k] = v));
83+
Object.entries(processEnvCP).forEach(([k, v]) => {
84+
// eslint-disable-next-line functional/immutable-data
85+
process.env[k] = v;
86+
});
8387
});
84-
/* eslint-enable functional/immutable-data, @typescript-eslint/no-dynamic-delete */
8588

8689
it('should execute no specific command by default', async () => {
8790
const cwd = path.join(testFileDir, 'execute-default-command');
@@ -179,6 +182,7 @@ describe('executor command', () => {
179182
},
180183
},
181184
);
185+
logger.setVerbose(true);
182186

183187
const { stdout, code } = await executeProcess({
184188
command: 'npx',

e2e/nx-plugin-e2e/tests/plugin-create-nodes.e2e.test.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -189,28 +189,27 @@ describe('nx-plugin', () => {
189189

190190
await materializeTree(tree, cwd);
191191

192-
const { stdout, stderr } = await executeProcess({
192+
const { stdout } = await executeProcess({
193193
command: 'npx',
194-
args: ['nx', 'run', `${project}:code-pushup`, '--dryRun'],
194+
args: ['nx', 'run', `${project}:code-pushup`, '--dryRun', '--verbose'],
195195
cwd,
196196
});
197197

198-
const cleanStderr = removeColorCodes(stderr);
199-
// @TODO create test environment for working plugin. This here misses package-lock.json to execute correctly
200-
expect(cleanStderr).toContain('DryRun execution of: npx @code-pushup/cli');
201-
202198
const cleanStdout = removeColorCodes(stdout);
203-
expect(cleanStdout).toContain(
204-
'NX Successfully ran target code-pushup for project my-lib',
205-
);
199+
// Nx command
200+
expect(cleanStdout).toContain('nx run my-lib:code-pushup');
201+
// Run CLI executor
202+
expect(cleanStdout).toContain('Command: npx @code-pushup/cli');
203+
expect(cleanStdout).toContain('--dryRun --verbose');
206204
});
207205

208206
it('should consider plugin option bin in executor target', async () => {
209-
const cwd = path.join(testFileDir, 'configuration-option-bin');
207+
const cwd = path.join(testFileDir, 'executor-option-bin');
208+
const binPath = `packages/cli/dist`;
210209
registerPluginInWorkspace(tree, {
211210
plugin: '@code-pushup/nx-plugin',
212211
options: {
213-
bin: 'XYZ',
212+
bin: binPath,
214213
},
215214
});
216215
const { root } = readProjectConfiguration(tree, project);
@@ -223,13 +222,15 @@ describe('nx-plugin', () => {
223222

224223
expect(projectJson.targets).toStrictEqual({
225224
'code-pushup': expect.objectContaining({
226-
executor: 'XYZ:cli',
225+
options: {
226+
bin: binPath,
227+
},
227228
}),
228229
});
229230
});
230231

231232
it('should consider plugin option projectPrefix in executor target', async () => {
232-
const cwd = path.join(testFileDir, 'configuration-option-bin');
233+
const cwd = path.join(testFileDir, 'executor-option-projectPrefix');
233234
registerPluginInWorkspace(tree, {
234235
plugin: '@code-pushup/nx-plugin',
235236
options: {
Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
1-
/// <reference types="vitest" />
2-
import { defineConfig } from 'vite';
3-
import { tsconfigPathAliases } from '../../tools/vitest-tsconfig-path-aliases.js';
1+
import { createE2ETestConfig } from '../../testing/test-setup-config/src/index.js';
42

5-
export default defineConfig({
6-
cacheDir: '../../node_modules/.vite/nx-plugin-e2e',
7-
test: {
8-
reporters: ['basic'],
9-
testTimeout: 80_000,
10-
globals: true,
11-
alias: tsconfigPathAliases(),
12-
pool: 'threads',
13-
poolOptions: { threads: { singleThread: true } },
14-
cache: {
15-
dir: '../../node_modules/.vitest',
16-
},
17-
environment: 'node',
18-
include: ['tests/**/*.e2e.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
19-
setupFiles: ['../../testing/test-setup/src/lib/reset.mocks.ts'],
20-
},
3+
export default createE2ETestConfig('nx-plugin-e2e', {
4+
testTimeout: 80_000,
215
});

0 commit comments

Comments
 (0)