Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should set hasErrors on context to true on error', async () => {
execa.mockResolvedValueOnce({
stdout: 'Mock error',
stderr: '',
code: 0,
failed: true,
cmd: 'mock cmd'
})
const context = {}
const taskFn = resolveTaskFn({ ...defaultOpts, linter: 'mock-fail-linter' })
expect.assertions(1)
try {
await taskFn(context)
} catch (err) {
expect(context.hasErrors).toEqual(true)
}
})
})