mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-22 18:48:06 +08:00
Add the "@actions/exit" package
It is useful to have the exit logic separated into its own package
This commit is contained in:
19
packages/exit/__tests__/exit.test.ts
Normal file
19
packages/exit/__tests__/exit.test.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import * as exit from '../src/exit'
|
||||
|
||||
it('exits successfully', () => {
|
||||
jest.spyOn(process, 'exit').mockImplementation()
|
||||
exit.success()
|
||||
expect(process.exit).toHaveBeenCalledWith(0)
|
||||
})
|
||||
|
||||
it('exits as a failure', () => {
|
||||
jest.spyOn(process, 'exit').mockImplementation()
|
||||
exit.failure()
|
||||
expect(process.exit).toHaveBeenCalledWith(1)
|
||||
})
|
||||
|
||||
it('exits neutrally', () => {
|
||||
jest.spyOn(process, 'exit').mockImplementation()
|
||||
exit.neutral()
|
||||
expect(process.exit).toHaveBeenCalledWith(78)
|
||||
})
|
||||
Reference in New Issue
Block a user