From 33b3367cff88a236b9e79e4fd2990bdcd06ae47a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A8r=20Kessels?= Date: Wed, 16 Feb 2022 10:38:46 +0100 Subject: [PATCH] fix: add an unreachable return, to test signal termination --- src/signal-termination.ts | 1 + test/signal-termination.spec.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/signal-termination.ts b/src/signal-termination.ts index 84c2c26..5e4120f 100644 --- a/src/signal-termination.ts +++ b/src/signal-termination.ts @@ -94,6 +94,7 @@ export class TermSignals { } if (code !== undefined) { 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) })