Skip to content

Commit 00c1b04

Browse files
committed
revert cli-e2e changes
1 parent 5ed0731 commit 00c1b04

File tree

4 files changed

+23
-36
lines changed

4 files changed

+23
-36
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
} from '@code-pushup/models';
99
import { cleanTestFolder } from '@code-pushup/test-setup';
1010
import { executeProcess, readJsonFile, readTextFile } from '@code-pushup/utils';
11-
import { EXAMPLES_REACT_TODOS_APP } from '../mocks/fixtures/constant';
1211

1312
describe('CLI collect', () => {
1413
const exampleCategoryTitle = 'Code style';
@@ -51,13 +50,14 @@ describe('CLI collect', () => {
5150
});
5251

5352
it('should run ESLint plugin and create report.json', async () => {
54-
const { code } = await executeProcess({
53+
const { code, stderr } = await executeProcess({
5554
command: 'code-pushup',
5655
args: ['collect', '--no-progress', '--onlyPlugins=eslint'],
57-
cwd: EXAMPLES_REACT_TODOS_APP,
56+
cwd: 'examples/react-todos-app',
5857
});
5958

6059
expect(code).toBe(0);
60+
expect(stderr).toBe('');
6161

6262
const report = await readJsonFile('tmp/e2e/react-todos-app/report.json');
6363

@@ -91,7 +91,6 @@ describe('CLI collect', () => {
9191
'--persist.outputDir=tmp/e2e',
9292
'--onlyPlugins=coverage',
9393
],
94-
cwd: EXAMPLES_REACT_TODOS_APP,
9594
});
9695

9796
expect(code).toBe(0);
@@ -107,7 +106,7 @@ describe('CLI collect', () => {
107106
const { code, stderr } = await executeProcess({
108107
command: 'code-pushup',
109108
args: ['collect', '--no-progress', '--onlyPlugins=coverage'],
110-
cwd: EXAMPLES_REACT_TODOS_APP,
109+
cwd: 'examples/react-todos-app',
111110
});
112111

113112
expect(code).toBe(0);
@@ -123,7 +122,7 @@ describe('CLI collect', () => {
123122
const { code, stderr } = await executeProcess({
124123
command: 'code-pushup',
125124
args: ['collect', '--persist.format=md', '--no-progress'],
126-
cwd: EXAMPLES_REACT_TODOS_APP,
125+
cwd: 'examples/react-todos-app',
127126
});
128127

129128
expect(code).toBe(0);
@@ -140,7 +139,7 @@ describe('CLI collect', () => {
140139
const { code, stdout, stderr } = await executeProcess({
141140
command: 'code-pushup',
142141
args: ['collect', '--no-progress'],
143-
cwd: EXAMPLES_REACT_TODOS_APP,
142+
cwd: 'examples/react-todos-app',
144143
});
145144

146145
expect(code).toBe(0);

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

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,56 @@ import { simpleGit } from 'simple-git';
22
import type { ReportsDiff } from '@code-pushup/models';
33
import { cleanTestFolder } from '@code-pushup/test-setup';
44
import { executeProcess, readJsonFile, readTextFile } from '@code-pushup/utils';
5-
import { EXAMPLES_REACT_TODOS_APP } from '../mocks/fixtures/constant';
65

76
describe('CLI compare', () => {
87
const git = simpleGit();
98

109
beforeEach(async () => {
11-
if (await git.diff(['--', EXAMPLES_REACT_TODOS_APP])) {
10+
if (await git.diff(['--', 'examples/react-todos-app'])) {
1211
throw new Error(
1312
'Unstaged changes found in examples/react-todos-app, please stage or commit them to prevent E2E tests interfering',
1413
);
1514
}
1615
await cleanTestFolder('tmp/e2e/react-todos-app');
1716
await executeProcess({
18-
command: 'npx',
17+
command: 'code-pushup',
1918
args: [
20-
'@code-pushup/cli',
2119
'collect',
2220
'--persist.filename=source-report',
2321
'--onlyPlugins=eslint',
2422
],
25-
cwd: EXAMPLES_REACT_TODOS_APP,
23+
cwd: 'examples/react-todos-app',
2624
});
2725
await executeProcess({
2826
command: 'npx',
2927
args: ['eslint', '--fix', 'src', '--ext=js,jsx'],
30-
cwd: EXAMPLES_REACT_TODOS_APP,
28+
cwd: 'examples/react-todos-app',
3129
});
3230
await executeProcess({
33-
command: 'npx',
31+
command: 'code-pushup',
3432
args: [
35-
'@code-pushup/cli',
3633
'collect',
3734
'--persist.filename=target-report',
3835
'--onlyPlugins=eslint',
3936
],
40-
cwd: EXAMPLES_REACT_TODOS_APP,
37+
cwd: 'examples/react-todos-app',
4138
});
4239
}, 20_000);
4340

4441
afterEach(async () => {
45-
await git.checkout(['--', EXAMPLES_REACT_TODOS_APP]);
42+
await git.checkout(['--', 'examples/react-todos-app']);
4643
await cleanTestFolder('tmp/e2e');
4744
});
4845

49-
// eslint-disable-next-line vitest/no-disabled-tests
50-
it.skip('should compare report.json files and create report-diff.json and report-diff.md', async () => {
46+
it('should compare report.json files and create report-diff.json and report-diff.md', async () => {
5147
await executeProcess({
52-
command: 'npx',
48+
command: 'code-pushup',
5349
args: [
54-
'@code-pushup/cli',
5550
'compare',
5651
'--before=../../tmp/e2e/react-todos-app/source-report.json',
5752
'--after=../../tmp/e2e/react-todos-app/target-report.json',
5853
],
59-
cwd: EXAMPLES_REACT_TODOS_APP,
54+
cwd: 'examples/react-todos-app',
6055
});
6156

6257
const reportsDiff = await readJsonFile<ReportsDiff>(

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
import { removeColorCodes } from '@code-pushup/test-utils';
22
import { executeProcess } from '@code-pushup/utils';
3-
import { EXAMPLES_REACT_TODOS_APP } from '../mocks/fixtures/constant';
43

54
describe('CLI help', () => {
65
it('should print help with help command', async () => {
76
const { code, stdout, stderr } = await executeProcess({
8-
command: 'npx',
9-
args: ['@code-pushup/cli', 'help'],
10-
cwd: EXAMPLES_REACT_TODOS_APP,
7+
command: 'code-pushup',
8+
args: ['help'],
119
});
1210
expect(code).toBe(0);
1311
expect(stderr).toBe('');
@@ -16,14 +14,12 @@ describe('CLI help', () => {
1614

1715
it('should produce the same output to stdout for both help argument and help command', async () => {
1816
const helpArgResult = await executeProcess({
19-
command: 'npx',
20-
args: ['@code-pushup/cli', 'help'],
21-
cwd: EXAMPLES_REACT_TODOS_APP,
17+
command: 'code-pushup',
18+
args: ['help'],
2219
});
2320
const helpCommandResult = await executeProcess({
24-
command: 'npx',
25-
args: ['@code-pushup/cli', '--help'],
26-
cwd: EXAMPLES_REACT_TODOS_APP,
21+
command: 'code-pushup',
22+
args: ['--help'],
2723
});
2824
expect(helpArgResult.code).toBe(0);
2925
expect(helpCommandResult.code).toBe(0);

e2e/cli-e2e/tests/print-config.e2e.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
import { join } from 'node:path';
22
import { expect } from 'vitest';
33
import { executeProcess } from '@code-pushup/utils';
4-
import { EXAMPLES_REACT_TODOS_APP } from '../mocks/fixtures/constant';
54

65
const extensions = ['js', 'mjs', 'ts'] as const;
76
export const configFilePath = (ext: (typeof extensions)[number]) =>
87
join(process.cwd(), `e2e/cli-e2e/mocks/fixtures/code-pushup.config.${ext}`);
98

10-
describe('CLI print-config', () => {
9+
describe('print-config', () => {
1110
it.each(extensions)(
1211
'should load .%s config file with correct arguments',
1312
async ext => {
1413
const { code, stdout } = await executeProcess({
1514
command: 'code-pushup',
1615
args: [
17-
'@code-pushup/cli',
1816
'print-config',
1917
'--no-progress',
2018
`--config=${configFilePath(ext)}`,
@@ -24,7 +22,6 @@ describe('CLI print-config', () => {
2422
`--persist.filename=${ext}-report`,
2523
'--onlyPlugins=coverage',
2624
],
27-
cwd: EXAMPLES_REACT_TODOS_APP,
2825
});
2926

3027
expect(code).toBe(0);

0 commit comments

Comments
 (0)