Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
cbe02f2
feat(nx-plugin): add support for local code execution
BioPhoton Sep 5, 2025
b556bd8
refactor: revert plugin options
BioPhoton Sep 5, 2025
4bba9cd
test: update e2e tests
BioPhoton Sep 5, 2025
47bc389
refactor: adjust target options
BioPhoton Sep 5, 2025
695acbc
refactor: add int test for env vars
BioPhoton Sep 5, 2025
5d4fd60
refactor: remove dependencies on packages, use latest
BioPhoton Sep 5, 2025
052e18c
refactor: fix missing bin in command
BioPhoton Sep 5, 2025
e6ac40d
refactor: add colored formatting
BioPhoton Sep 5, 2025
311679f
refactor: fix tests for colored formatting
BioPhoton Sep 5, 2025
8f3b7fa
chore: cache nxv-e2e-setup
BioPhoton Sep 5, 2025
e9e4a3a
refactor: wip
BioPhoton Sep 5, 2025
a1d0f9d
refactor: wip 2
BioPhoton Sep 5, 2025
f1dd383
refactor: wip 3
BioPhoton Sep 5, 2025
93d1d40
refactor: fix e2e
BioPhoton Sep 5, 2025
41c900b
refactor: fix unit test
BioPhoton Sep 5, 2025
60183db
refactor: fix lint
BioPhoton Sep 5, 2025
ea73523
refactor: fix lint
BioPhoton Sep 5, 2025
454960b
refactor: fix lint
BioPhoton Sep 5, 2025
b368ac0
refactor: fix lint
BioPhoton Sep 6, 2025
d5e05a4
refactor: adjust command logic
BioPhoton Sep 6, 2025
2041093
refactor: adjust command logic
BioPhoton Sep 6, 2025
bebae7c
refactor: wip
BioPhoton Sep 6, 2025
f947823
refactor: wip
BioPhoton Sep 6, 2025
752a97e
refactor: wip
BioPhoton Sep 6, 2025
4e90518
refactor: wip
BioPhoton Sep 6, 2025
a180d5c
test(nx-plugin): add tests for buildCommandString
BioPhoton Sep 6, 2025
41f9af2
refactor: wip
BioPhoton Sep 6, 2025
9dff7c4
refactor: revert versions change
BioPhoton Sep 6, 2025
0f3ba3a
Update CONTRIBUTING.md
BioPhoton Sep 8, 2025
cefe54d
Update packages/nx-plugin/src/executors/cli/executor.ts
BioPhoton Sep 8, 2025
d9b453f
Update CONTRIBUTING.md
BioPhoton Sep 8, 2025
7b307d0
Update CONTRIBUTING.md
BioPhoton Sep 8, 2025
a2892ba
refactor: move logic into command.ts
BioPhoton Sep 8, 2025
ff74241
refactor: adjust tests
BioPhoton Sep 8, 2025
fc990a6
refactor: fix build
BioPhoton Sep 8, 2025
b1875d3
refactor: adjust models
BioPhoton Sep 8, 2025
371e70b
refactor: adjust comments
BioPhoton Sep 8, 2025
ab3f5ed
refactor: adjust comments
BioPhoton Sep 8, 2025
aa0950a
refactor: remove comments
BioPhoton Sep 8, 2025
1d006f2
refactor: fix e2e
BioPhoton Sep 8, 2025
fe6d69b
refactor: fix int
BioPhoton Sep 8, 2025
57c13c6
refactor: fix int 2
BioPhoton Sep 8, 2025
39c112a
refactor: fix int 3
BioPhoton Sep 8, 2025
bdf038a
refactor: revert out of scope
BioPhoton Sep 8, 2025
be19204
Merge branch 'main' into refactor/utils/command-helper
BioPhoton Sep 8, 2025
1f2712a
refactor: fix ci int test
BioPhoton Sep 8, 2025
f7d8730
refactor: wip
BioPhoton Sep 10, 2025
ff432bf
refactor: wip 2
BioPhoton Sep 10, 2025
36faf27
refactor: revert to spawn
BioPhoton Sep 10, 2025
1d05e8b
refactor: revert to spawn
BioPhoton Sep 10, 2025
f3c5dd5
refactor: revert escape
BioPhoton Sep 15, 2025
6bec56f
refactor: revert escape 2
BioPhoton Sep 15, 2025
40d5fb3
refactor: fix tests
BioPhoton Sep 15, 2025
0973f1c
refactor: revert all
BioPhoton Sep 16, 2025
51cd8c7
refactor: adjust execute-process logic
BioPhoton Sep 16, 2025
476adfa
refactor: fix tests
BioPhoton Sep 16, 2025
0fea136
Merge branch 'main' into refactor/utils/command-helper
BioPhoton Oct 4, 2025
15da0ab
refactor: fix unit tests
BioPhoton Oct 4, 2025
f1996ad
refactor: fix create-cli unit tests
BioPhoton Oct 4, 2025
3880c00
refactor: fix nx-plugin unit tests
BioPhoton Oct 4, 2025
04e96bc
Potential fix for code scanning alert no. 20: Incomplete string escap…
BioPhoton Oct 4, 2025
bbc10e7
refactor: fix ci int tests
Oct 4, 2025
d86726d
Merge remote-tracking branch 'origin/refactor/utils/command-helper' i…
Oct 4, 2025
36d8c2a
refactor: remove unused import
Oct 4, 2025
afe8f89
refactor: use copy of command and execute-process implementation from…
Oct 4, 2025
d3781cf
refactor: fix logger usage
Oct 4, 2025
9a5eb15
Apply suggestion from @BioPhoton
BioPhoton Oct 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/ci/src/lib/cli/commands/collect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export async function runCollect(
{ hasFormats }: { hasFormats: boolean },
): Promise<void> {
await executeProcess({
verbose: isVerbose(),
command: bin,
args: [
...(isVerbose() ? ['--verbose'] : []),
Expand Down
1 change: 1 addition & 0 deletions packages/ci/src/lib/cli/commands/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export async function runCompare(
{ hasFormats }: { hasFormats: boolean },
): Promise<void> {
await executeProcess({
verbose: isVerbose(),
command: bin,
args: [
'compare',
Expand Down
1 change: 1 addition & 0 deletions packages/ci/src/lib/cli/commands/merge-diffs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export async function runMergeDiffs(
const filename = `merged-${DEFAULT_PERSIST_FILENAME}`;

await executeProcess({
verbose: isVerbose(),
command: bin,
args: [
'merge-diffs',
Expand Down
1 change: 1 addition & 0 deletions packages/ci/src/lib/cli/commands/print-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export async function runPrintConfig({
path.resolve(directory, '.code-pushup', outputFile);

await executeProcess({
verbose: isVerbose(),
command: bin,
args: [
...(config ? [`--config=${config}`] : []),
Expand Down
3 changes: 3 additions & 0 deletions packages/ci/src/lib/monorepo/handlers/nx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
executeProcess,
fileExists,
interpolate,
isVerbose,
stringifyError,
toArray,
} from '@code-pushup/utils';
Expand All @@ -16,6 +17,7 @@ export const nxHandler: MonorepoToolHandler = {
(await fileExists(path.join(options.cwd, 'nx.json'))) &&
(
await executeProcess({
verbose: isVerbose(),
command: 'npx',
args: ['nx', 'report'],
cwd: options.cwd,
Expand All @@ -28,6 +30,7 @@ export const nxHandler: MonorepoToolHandler = {

async listProjects({ cwd, task, nxProjectsFilter, observer }) {
const { stdout } = await executeProcess({
verbose: isVerbose(),
command: 'npx',
args: [
'nx',
Expand Down
2 changes: 2 additions & 0 deletions packages/ci/src/lib/monorepo/handlers/nx.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ describe('nxHandler', () => {
'--exclude=*-e2e',
'--json',
],
verbose: false,
cwd: MEMFS_VOLUME,
} satisfies utils.ProcessConfig);
});
Expand All @@ -92,6 +93,7 @@ describe('nxHandler', () => {
command: 'npx',
args: ['nx', 'show', 'projects', '--with-target=code-pushup', '--json'],
cwd: MEMFS_VOLUME,
verbose: false,
} satisfies utils.ProcessConfig);
});

Expand Down
1 change: 1 addition & 0 deletions packages/ci/src/lib/monorepo/list-projects.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ describe('listMonorepoProjects', () => {
args: ['nx', 'show', 'projects', '--with-target=code-pushup', '--json'],
cwd: process.cwd(),
observer: expect.any(Object),
verbose: false,
});
});

Expand Down
33 changes: 33 additions & 0 deletions packages/ci/src/lib/run.int.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,14 @@ describe('runInCI', () => {
args: ['print-config', expect.stringMatching(/^--output=.*\.json$/)],
cwd: workDir,
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenNthCalledWith(2, {
command: options.bin,
args: [],
cwd: workDir,
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);

expect(logger.error).not.toHaveBeenCalled();
Expand Down Expand Up @@ -372,30 +374,35 @@ describe('runInCI', () => {
args: ['print-config', expect.stringMatching(/^--output=.*\.json$/)],
cwd: workDir,
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenNthCalledWith(2, {
command: options.bin,
args: [],
cwd: workDir,
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenNthCalledWith(3, {
command: options.bin,
args: ['print-config', expect.stringMatching(/^--output=.*\.json$/)],
cwd: workDir,
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenNthCalledWith(4, {
command: options.bin,
args: [],
cwd: workDir,
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenNthCalledWith(5, {
command: options.bin,
args: ['compare'],
cwd: workDir,
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);

expect(logger.error).not.toHaveBeenCalled();
Expand Down Expand Up @@ -450,18 +457,21 @@ describe('runInCI', () => {
args: ['print-config', expect.stringMatching(/^--output=.*\.json$/)],
cwd: workDir,
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenNthCalledWith(2, {
command: options.bin,
args: [],
cwd: workDir,
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenNthCalledWith(3, {
command: options.bin,
args: ['compare'],
cwd: workDir,
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);

expect(logger.error).not.toHaveBeenCalled();
Expand Down Expand Up @@ -521,18 +531,21 @@ describe('runInCI', () => {
args: ['print-config', expect.stringMatching(/^--output=.*\.json$/)],
cwd: workDir,
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenNthCalledWith(2, {
command: options.bin,
args: [],
cwd: workDir,
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenNthCalledWith(3, {
command: options.bin,
args: ['compare'],
cwd: workDir,
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);

expect(logger.error).not.toHaveBeenCalled();
Expand Down Expand Up @@ -580,6 +593,7 @@ describe('runInCI', () => {
args: expect.arrayContaining(['compare']),
cwd: workDir,
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
});
});
Expand Down Expand Up @@ -714,12 +728,14 @@ describe('runInCI', () => {
],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: runMany,
args: [],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);

expect(logger.error).not.toHaveBeenCalled();
Expand Down Expand Up @@ -789,6 +805,7 @@ describe('runInCI', () => {
args: [],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);

expect(logger.error).not.toHaveBeenCalled();
Expand Down Expand Up @@ -952,18 +969,21 @@ describe('runInCI', () => {
],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: runMany,
args: [],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: runMany,
args: ['compare'],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: run,
Expand All @@ -983,6 +1003,7 @@ describe('runInCI', () => {
],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);

expect(logger.error).not.toHaveBeenCalled();
Expand Down Expand Up @@ -1058,12 +1079,14 @@ describe('runInCI', () => {
args: [],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: runMany,
args: ['compare'],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: run,
Expand All @@ -1083,6 +1106,7 @@ describe('runInCI', () => {
],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).not.toHaveBeenCalledWith(
expect.objectContaining({
Expand Down Expand Up @@ -1138,18 +1162,21 @@ describe('runInCI', () => {
args: expect.any(Array),
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: runMany,
args: expect.arrayContaining(['compare']),
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: run,
args: expect.arrayContaining(['merge-diffs']),
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
});
});
Expand Down Expand Up @@ -1242,12 +1269,14 @@ describe('runInCI', () => {
args: ['print-config', expect.stringMatching(/^--output=.*\.json$/)],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: options.bin,
args: [],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);

expect(logger.error).not.toHaveBeenCalled();
Expand Down Expand Up @@ -1411,18 +1440,21 @@ describe('runInCI', () => {
args: ['print-config', expect.stringMatching(/^--output=.*\.json$/)],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: options.bin,
args: [],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: options.bin,
args: ['compare'],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);
expect(utils.executeProcess).toHaveBeenCalledWith({
command: options.bin,
Expand All @@ -1442,6 +1474,7 @@ describe('runInCI', () => {
],
cwd: expect.stringContaining(workDir),
observer: expectedObserver,
verbose: false,
} satisfies utils.ProcessConfig);

expect(logger.error).not.toHaveBeenCalled();
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/lib/implementation/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export async function executeRunnerConfig(
const { outputFile, outputTransform } = config;

const { duration, date } = await executeProcess({
verbose: isVerbose(),
command: config.command,
args: config.args,
observer: {
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/lib/implementation/runner.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ describe('executeRunnerConfig', () => {
onStdout: expect.any(Function),
onStderr: expect.any(Function),
},
verbose: false,
});
});

Expand Down
9 changes: 6 additions & 3 deletions packages/create-cli/src/lib/init.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
type ProcessConfig,
executeProcess,
isVerbose,
objectToCliArgs,
} from '@code-pushup/utils';
import {
Expand Down Expand Up @@ -29,6 +30,7 @@ export async function initCodePushup() {
...nxPluginGenerator('init', {
skipNxJson: true,
}),
verbose: isVerbose(),
observer: {
onStdout: data => {
console.info(parseNxProcessOutput(data.toString()));
Expand All @@ -39,12 +41,13 @@ export async function initCodePushup() {
},
});

const { stdout: configStdout, stderr: configStderr } = await executeProcess(
nxPluginGenerator('configuration', {
const { stdout: configStdout, stderr: configStderr } = await executeProcess({
...nxPluginGenerator('configuration', {
skipTarget: true,
project: setupResult.projectName,
}),
);
verbose: isVerbose(),
});
console.info(parseNxProcessOutput(configStdout));
console.warn(parseNxProcessOutput(configStderr));

Expand Down
2 changes: 2 additions & 0 deletions packages/create-cli/src/lib/init.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ describe('initCodePushup', () => {
command: 'npx',
args: ['nx', 'g', '@code-pushup/nx-plugin:init', '--skipNxJson'],
observer: expect.any(Object),
verbose: false,
});
expect(spyParseNxProcessOutput).toHaveBeenNthCalledWith(1, 'stdout-mock');
expect(spyExecuteProcess).toHaveBeenNthCalledWith(2, {
Expand All @@ -71,6 +72,7 @@ describe('initCodePushup', () => {
'--skipTarget',
`--project="${projectJson.name}"`,
],
verbose: false,
});
expect(spyParseNxProcessOutput).toHaveBeenNthCalledWith(1, 'stdout-mock');
expect(spyParseNxProcessOutput).toHaveBeenCalledTimes(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ describe('runAutorunExecutor', () => {
onError: expect.any(Function),
onStdout: expect.any(Function),
},
verbose: true,
});
});
});
Loading