@@ -34,16 +34,15 @@ test.afterEach.always(() => {
34
34
test . serial ( "ui5lint --format json" , async ( t ) => {
35
35
const { cli, consoleLogStub, processCwdStub, processStdoutWriteStub, processExitStub} = t . context ;
36
36
37
- // Instead of testing actual process.exitCode
38
- const before = process . exitCode ;
39
37
await cli . parseAsync ( [ "--format" , "json" ] ) ;
40
- t . not ( before , process . exitCode , "Exit code was changed" ) ;
41
- process . exitCode = 0 ; // Reset immediately
42
38
43
39
t . is ( consoleLogStub . callCount , 0 , "console.log should not be used" ) ;
44
40
t . true ( processCwdStub . callCount > 0 , "process.cwd was called" ) ;
45
41
t . is ( processStdoutWriteStub . callCount , 2 , "process.stdout.write was called twice" ) ;
46
42
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 ;
47
46
48
47
const resultProcessStdoutJSON = processStdoutWriteStub . firstCall . firstArg ;
49
48
let parsedJson : LintResult [ ] ;
@@ -67,12 +66,11 @@ test.serial("ui5lint --format markdown", async (t) => {
67
66
t . true ( processCwdStub . callCount > 0 , "process.cwd was called" ) ;
68
67
t . is ( processStdoutWriteStub . callCount , 2 , "process.stdout.write was called twice" ) ;
69
68
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)
72
71
process . exitCode = 0 ;
73
72
74
73
const resultProcessStdoutMarkdown = processStdoutWriteStub . firstCall . firstArg ;
75
- t . true ( resultProcessStdoutMarkdown . length > 0 , "Output is not empty" ) ;
76
74
t . true ( resultProcessStdoutMarkdown . startsWith ( "# UI5 Linter Report" ) ,
77
75
"Output starts with the expected Markdown header" ) ;
78
76
0 commit comments