Skip to content

Commit f95b625

Browse files
committed
feat(utils): ensure consistent line breaks in stdout report
1 parent 364069d commit f95b625

File tree

15 files changed

+28
-49
lines changed

15 files changed

+28
-49
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('CLI collect', () => {
5959

6060
const md = await readTextFile(path.join(dummyOutputDir, 'report.md'));
6161

62-
expect(md).toContain('# Code PushUp Report');
62+
expect(md).toContain('# Code PushUp report');
6363
expect(md).toContain(dummyPluginTitle);
6464
expect(md).toContain(dummyAuditTitle);
6565
});
@@ -112,7 +112,7 @@ describe('CLI collect', () => {
112112

113113
expect(code).toBe(0);
114114

115-
expect(stdout).toContain('Code PushUp Report');
115+
expect(stdout).toContain('Code PushUp report');
116116
expect(stdout).not.toContain('Generated reports');
117117
expect(stdout).toContain(dummyPluginTitle);
118118
expect(stdout).toContain(dummyAuditTitle);

packages/ci/mocks/fixtures/outputs/report-after.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Code PushUp Report
1+
# Code PushUp report
22

33
## 🛡️ Audits
44

packages/ci/mocks/fixtures/outputs/report-before.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Code PushUp Report
1+
# Code PushUp report
22

33
## 🛡️ Audits
44

packages/cli/docs/custom-plugins.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ Execute the CLI with `npx code-pushup collect` and you should the following outp
9292
<summary> <b>stdout of CLI for the above code</b> (collapsed for brevity) </summary>
9393

9494
```sh
95-
Code PushUp Report - @code-pushup/core@x.y.z
95+
Code PushUp report
9696

9797
My plugin audits
9898
● My audit 0
@@ -240,7 +240,7 @@ Now we can execute the CLI with `npx code-pushup collect` and see a similar outp
240240
<summary> <b>stdout of CLI for the above code</b> (collapsed for brevity) </summary>
241241

242242
```sh
243-
Code PushUp Report - @code-pushup/core@x.y.z
243+
Code PushUp report
244244

245245
File size plugin audits
246246
● File size audit 2 files
@@ -371,7 +371,7 @@ Now we can execute the CLI with `npx code-pushup collect` and see a similar outp
371371
<summary> <b>stdout of CLI for the above code</b> (collapsed for brevity) </summary>
372372

373373
```sh
374-
Code PushUp Report - @code-pushup/core@x.y.z
374+
Code PushUp report
375375

376376
Chrome Lighthosue audits
377377
● Largest Contentful Paint 0
@@ -656,7 +656,7 @@ Test the output by running `npx code-pushup collect`.
656656
<summary> <b>stdout of basic lighthouse plugin</b> (collapsed for brevity) </summary>
657657

658658
```sh
659-
Code PushUp Report - @code-pushup/core@x.y.z
659+
Code PushUp report
660660

661661
Chrome Lighthouse audits
662662
● Largest Contentful Paint 1,3 s

packages/cli/src/lib/autorun/autorun-command.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export function yargsAutorunCommandObject() {
3636
};
3737

3838
await collectAndPersistReports(optionsWithFormat);
39-
logger.newline();
4039

4140
if (!options.categories?.length) {
4241
renderCategoriesHint();

packages/cli/src/lib/collect/collect-command.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {
33
type CollectAndPersistReportsOptions,
44
collectAndPersistReports,
55
} from '@code-pushup/core';
6-
import { logger } from '@code-pushup/utils';
76
import {
87
printCliCommand,
98
renderCategoriesHint,
@@ -24,15 +23,13 @@ export function yargsCollectCommandObject(): CommandModule {
2423
await collectAndPersistReports(options);
2524

2625
if (!options.categories?.length) {
27-
logger.newline();
2826
renderCategoriesHint();
2927
}
3028

3129
const { upload } = args as unknown as Record<
3230
'upload',
3331
object | undefined
3432
>;
35-
logger.newline();
3633
if (upload) {
3734
renderUploadHint();
3835
} else {

packages/core/src/lib/collect-and-persist.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,8 @@ export async function collectAndPersistReports(
4343

4444
// terminal output
4545
logger.newline();
46+
logger.newline();
4647
logStdoutSummary(sortedScoredReport);
48+
logger.newline();
49+
logger.newline();
4750
}

packages/utils/src/lib/reports/__snapshots__/generate-md-report.unit.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ No unsafe any assignment [📖 Docs](https://web.dev/lcp)
6868
`;
6969

7070
exports[`generateMdReport > should render complete md report 1`] = `
71-
"# Code PushUp Report
71+
"# Code PushUp report
7272
7373
| 🏷 Category | ⭐ Score | 🛡 Audits |
7474
| :-------------------------- | :----------: | :-------: |

packages/utils/src/lib/reports/__snapshots__/report-stdout-all-perfect-scores.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
Code PushUp Report - @code-pushup/core@0.0.1
2-
1+
Code PushUp report
32

43
ESLint audits
54

65
● ... All 47 audits have perfect scores ...
76

8-
97
Lighthouse audits
108

119
● Minimize third-party usage Third-party code blocked the main
@@ -26,4 +24,3 @@ Categories
2624
└──────────────────┴─────────┴──────────┘
2725

2826
Made with ❤ by code-pushup.dev
29-

packages/utils/src/lib/reports/__snapshots__/report-stdout-no-categories.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Code PushUp Report - @code-pushup/core@0.0.1
2-
1+
Code PushUp report
32

43
ESLint audits
54

@@ -19,7 +18,6 @@ ESLint audits
1918
● Require the use of `===` and `!==` 1 warning
2019
● ... + 37 audits with perfect scores ...
2120

22-
2321
Lighthouse audits
2422

2523
● Minimize third-party usage Third-party code blocked the main
@@ -30,4 +28,3 @@ Lighthouse audits
3028
● ... + 2 audits with perfect scores ...
3129

3230
Made with ❤ by code-pushup.dev
33-

0 commit comments

Comments
 (0)