diff --git a/src/signal-termination.ts b/src/signal-termination.ts index db8b6fc..5e4120f 100644 --- a/src/signal-termination.ts +++ b/src/signal-termination.ts @@ -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') } diff --git a/test/signal-termination.spec.ts b/test/signal-termination.spec.ts index f203ff9..96ad89c 100644 --- a/test/signal-termination.spec.ts +++ b/test/signal-termination.spec.ts @@ -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) })