Merge pull request #346 from berkes/fix/ts-return-void

fix: returning "true" instead of "void"
This commit is contained in:
Todd Bluhm 2024-11-23 02:40:36 -06:00 committed by GitHub
commit d91335a790
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 2 deletions

View File

@ -89,10 +89,12 @@ export class TermSignals {
*/ */
public _terminateProcess (code?: number, signal?: NodeJS.Signals): void { public _terminateProcess (code?: number, signal?: NodeJS.Signals): void {
if (signal !== undefined) { if (signal !== undefined) {
return process.kill(process.pid, signal) process.kill(process.pid, signal)
return
} }
if (code !== undefined) { 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') 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)
}) })