diff --git a/src/exit.ts b/src/exit.ts index 6a1c33a..c501fb6 100644 --- a/src/exit.ts +++ b/src/exit.ts @@ -23,7 +23,7 @@ export class Exit { /** * Stop the action with a "success" status */ - public success (message?: string) { + public success (message?: string): never { if (message) this.logger.success(message) process.exit(SuccessCode) } @@ -31,7 +31,7 @@ export class Exit { /** * Stop the action with a "neutral" status */ - public neutral (message?: string) { + public neutral (message?: string): never { if (message) this.logger.info(message) process.exit(NeutralCode) } @@ -39,7 +39,7 @@ export class Exit { /** * Stop the action with a "failed" status */ - public failure (message?: string) { + public failure (message?: string): never { if (message) this.logger.fatal(message) process.exit(FailureCode) } diff --git a/tests/index.test.ts b/tests/index.test.ts index 39f7271..42bdfc8 100644 --- a/tests/index.test.ts +++ b/tests/index.test.ts @@ -37,7 +37,7 @@ describe('Toolkit', () => { it('logs and fails when the function throws an error', async () => { const err = new Error('Whoops!') - const exitFailure = jest.fn() + const exitFailure = jest.fn() await Toolkit.run(async twolkit => { twolkit.exit.failure = exitFailure