Skip to content

Commit 6e64a0b

Browse files
author
John Doe
committed
refactor: wip
1 parent d3fe1f3 commit 6e64a0b

File tree

2 files changed

+12
-24
lines changed

2 files changed

+12
-24
lines changed

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

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,17 @@ async function addTargetToWorkspace(
2727
) {
2828
const { cwd, project } = options;
2929
const projectCfg = readProjectConfiguration(tree, project);
30-
const { root } = projectCfg;
31-
const configPath = path.join(root, 'code-pushup.config.ts');
3230
updateProjectConfiguration(tree, project, {
3331
...projectCfg,
3432
targets: {
3533
...projectCfg.targets,
3634
'code-pushup': {
3735
executor: '@code-pushup/nx-plugin:cli',
38-
options: {
39-
config: configPath,
40-
...executorOptions,
41-
},
36+
...(executorOptions && { options: executorOptions }),
4237
},
4338
},
4439
});
40+
const { root } = projectCfg;
4541
generateCodePushupConfig(tree, root, {
4642
plugins: [
4743
{
@@ -148,22 +144,19 @@ describe('executor command', () => {
148144
).resolves.not.toThrow();
149145
});
150146

151-
it('should execute print-config executor with upload config', async () => {
147+
it('should execute print-config executor with api key', async () => {
152148
const cwd = path.join(testFileDir, 'execute-print-config-command');
153149
await addTargetToWorkspace(tree, { cwd, project });
154150

155151
const { stdout, code } = await executeProcess({
156152
command: 'npx',
157-
args: [
153+
args: expect.arrayContaining([
158154
'nx',
159155
'run',
160156
`${project}:code-pushup`,
161157
'print-config',
162158
'--upload.apiKey=a123a',
163-
'--upload.server=https://example.com',
164-
'--upload.organization=test-org',
165-
'--upload.project=test-project',
166-
],
159+
]),
167160
cwd,
168161
});
169162

@@ -184,7 +177,7 @@ describe('executor command', () => {
184177
{ cwd, project },
185178
{
186179
persist: {
187-
outputDir: path.join('libs', project, '.reports'),
180+
outputDir: '.reports',
188181
filename: 'report',
189182
},
190183
},
@@ -210,15 +203,9 @@ describe('executor command', () => {
210203
);
211204
expect(cleanStdout).toContain('Code PushUp CLI');
212205

213-
// Check for report in project root's .reports directory
214-
const reportPath = path.join(
215-
cwd,
216-
'libs',
217-
project,
218-
'.reports',
219-
'terminal-report.json',
220-
);
221-
await expect(readJsonFile(reportPath)).resolves.not.toThrow();
206+
await expect(
207+
readJsonFile(path.join(cwd, '.reports', 'terminal-report.json')),
208+
).resolves.not.toThrow();
222209
});
223210

224211
it('should execute collect executor and add report to sub folder named by project', async () => {
@@ -236,7 +223,7 @@ describe('executor command', () => {
236223
expect(cleanStdout).toContain('nx run my-lib:code-pushup collect');
237224

238225
const report = await readJsonFile(
239-
path.join(cwd, 'libs', project, '.code-pushup', project, 'report.json'),
226+
path.join(cwd, '.code-pushup', project, 'report.json'),
240227
);
241228
expect(report).toStrictEqual(
242229
expect.objectContaining({

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,10 @@ describe('nx-plugin', () => {
199199
const cleanStdout = removeColorCodes(stdout);
200200
// Nx command
201201
expect(cleanStdout).toContain('nx run my-lib:code-pushup');
202-
// Run CLI executor - check for DryRun execution message
202+
// Run CLI executor
203203
expect(cleanStdout).toContain('DryRun execution of:');
204204
expect(cleanStdout).toContain('npx @code-pushup/cli');
205+
expect(cleanStdout).toContain('--dryRun');
205206
expect(cleanStdout).not.toContain('--verbose');
206207
});
207208

0 commit comments

Comments
 (0)