Skip to content

Commit

Permalink
test: cover --verbose option usage
Browse files Browse the repository at this point in the history
  • Loading branch information
iiroj committed Apr 25, 2020
1 parent 1b18550 commit efffa22
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/resolveTaskFn.spec.js
Expand Up @@ -202,4 +202,33 @@ describe('resolveTaskFn', () => {
)
expect(context.errors.has(TaskError)).toEqual(true)
})

it('should add output even when task succeeds if `verbose: true`', async () => {
expect.assertions(2)
execa.mockResolvedValueOnce({
stdout: 'Mock success',
stderr: '',
code: 0,
failed: false,
killed: false,
signal: undefined,
cmd: 'mock cmd'
})

const taskFn = resolveTaskFn({ ...defaultOpts, command: 'mock cmd', verbose: true })
const context = getInitialState()
await expect(taskFn(context)).resolves.toMatchInlineSnapshot(`undefined`)
expect(context).toMatchInlineSnapshot(`
Object {
"errors": Set {},
"hasPartiallyStagedFiles": null,
"output": Array [
"
i mock cmd:
Mock success",
],
"shouldBackup": null,
}
`)
})
})

0 comments on commit efffa22

Please sign in to comment.