Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: returning "true" instead of "void" #346

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/signal-termination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,12 @@ export class TermSignals {
*/
public _terminateProcess (code?: number, signal?: NodeJS.Signals): void {
if (signal !== undefined) {
return process.kill(process.pid, signal)
process.kill(process.pid, signal)
return
}
if (code !== undefined) {
return process.exit(code)
process.exit(code)
return // eslint-disable-line no-unreachable
}
throw new Error('Unable to terminate parent process successfully')
}
Expand Down
1 change: 1 addition & 0 deletions test/signal-termination.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ describe('signal-termination', (): void => {

it('should call exit method on parent process if no signal provided', (): void => {
term._terminateProcess(0)
// We here test code that in reality is unreachable.
assert.equal(exitStub.callCount, 1)
})

Expand Down