Skip to content

Commit b10be3d

Browse files
committed
fix: Revert exit tests
1 parent 936e329 commit b10be3d

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

test/lib/cli/base.integration.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,15 @@ test.afterEach.always(() => {
3434
test.serial("ui5lint --format json", async (t) => {
3535
const {cli, consoleLogStub, processCwdStub, processStdoutWriteStub, processExitStub} = t.context;
3636

37-
// Instead of testing actual process.exitCode
38-
const before = process.exitCode;
3937
await cli.parseAsync(["--format", "json"]);
40-
t.not(before, process.exitCode, "Exit code was changed");
41-
process.exitCode = 0; // Reset immediately
4238

4339
t.is(consoleLogStub.callCount, 0, "console.log should not be used");
4440
t.true(processCwdStub.callCount > 0, "process.cwd was called");
4541
t.is(processStdoutWriteStub.callCount, 2, "process.stdout.write was called twice");
4642
t.is(processExitStub.callCount, 0, "process.exit got never called");
43+
t.is(process.exitCode, 1, "process.exitCode was set to 1");
44+
// cleanup: reset exit code in order not to fail the test (it cannot be stubbed with sinon)
45+
process.exitCode = 0;
4746

4847
const resultProcessStdoutJSON = processStdoutWriteStub.firstCall.firstArg;
4948
let parsedJson: LintResult[];
@@ -67,12 +66,11 @@ test.serial("ui5lint --format markdown", async (t) => {
6766
t.true(processCwdStub.callCount > 0, "process.cwd was called");
6867
t.is(processStdoutWriteStub.callCount, 2, "process.stdout.write was called twice");
6968
t.is(processExitStub.callCount, 0, "process.exit got never called");
70-
71-
// Reset immediately
69+
t.is(process.exitCode, 1, "process.exitCode was set to 1");
70+
// cleanup: reset exit code in order not to fail the test (it cannot be stubbed with sinon)
7271
process.exitCode = 0;
7372

7473
const resultProcessStdoutMarkdown = processStdoutWriteStub.firstCall.firstArg;
75-
t.true(resultProcessStdoutMarkdown.length > 0, "Output is not empty");
7674
t.true(resultProcessStdoutMarkdown.startsWith("# UI5 Linter Report"),
7775
"Output starts with the expected Markdown header");
7876

0 commit comments

Comments
 (0)