mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(exit) add ability to receive error as argument
This commit is contained in:
parent
2b9fca8485
commit
aacf36babd
3 changed files with 23 additions and 6 deletions
|
|
@ -32,3 +32,19 @@ test('cloudcmd: exit: console.error', (t) => {
|
|||
t.end();
|
||||
});
|
||||
|
||||
test('cloudcmd: exit.error: console.error: error', (t) => {
|
||||
const {exit:exitOriginal} = process;
|
||||
const {error} = console;
|
||||
|
||||
console.error = sinon.stub();
|
||||
process.exit = sinon.stub();
|
||||
|
||||
exit(Error('hello world'));
|
||||
t.ok(console.error.calledWith('hello world'), 'should call console.error');
|
||||
|
||||
process.exit = exitOriginal;
|
||||
console.error = error;
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue