fix: add an unreachable return, to test signal termination

This commit is contained in:
Bèr Kessels 2022-02-16 10:38:46 +01:00
parent bc94223674
commit 33b3367cff
2 changed files with 2 additions and 0 deletions

View File

@ -94,6 +94,7 @@ export class TermSignals {
} }
if (code !== undefined) { if (code !== undefined) {
process.exit(code) process.exit(code)
return // eslint-disable-line no-unreachable
} }
throw new Error('Unable to terminate parent process successfully') throw new Error('Unable to terminate parent process successfully')
} }

View File

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