Skip to content

fix: exit non-zero when tests fail - #35

Open
itskodama wants to merge 1 commit into
Paperback-iOS:0.9from
itskodama:fix/test-exit-code
Open

fix: exit non-zero when tests fail#35
itskodama wants to merge 1 commit into
Paperback-iOS:0.9from
itskodama:fix/test-exit-code

Conversation

@itskodama

Copy link
Copy Markdown

The problem

test counts failed tests and prints the total, then returns normally:

console.log('    Passed:', pc.green(passedTests))
console.log('    Failed:', pc.red(failedTests))
}

There is no process.exit or process.exitCode anywhere in the command, so the
process always ends with status 0. Failed: 4 and Failed: 0 look identical to
anything downstream, which makes the command unusable as a CI gate.

The change

if (failedTests > 0) {
  process.exitCode = 1
}

`test` counts failed tests, prints the total, and returns 0 regardless, so any
CI step running it reports success no matter how many sources are broken.

Sets `process.exitCode` rather than calling `process.exit()`, so the summary and
the `--output` report both flush before the process ends.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant