Add the "@actions/exit" package

It is useful to have the exit logic separated into its own package
This commit is contained in:
Jonathan Clem
2019-04-20 10:52:56 -04:00
parent 1e32709630
commit cca9523c73
7 changed files with 130 additions and 0 deletions

View 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)
})