Skip to content

Commit

Permalink
Add test for async errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 17, 2019
1 parent abc2f09 commit 2961029
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/helpers/gulpfiles/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,16 @@ export const inputNotFunc = () =>
export const inputThrows = () =>
src(DUMMY, { buffer }).pipe(
stream(() => {
throw new Error('test')
throw new Error('error')
}, opts),
)

// `input` async exceptions should be propagated
export const inputThrowsAsync = () =>
src(DUMMY, { buffer }).pipe(
stream(() => Promise.reject(new Error('error')), opts),
)

const cExecVinyl = async function(file) {
// When `file.contents` is a stream and an `error` event should be emitted,
// we should not read the stream with `get-stream`. Otherwise Gulp will
Expand Down
1 change: 1 addition & 0 deletions test/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ testEach(
[
{ task: 'inputNotFunc' },
{ task: 'inputThrows' },
{ task: 'inputThrowsAsync' },
{ task: 'inputAsync' },
{ task: 'inputFile', command: 'echo' },
{ task: 'inputUndefined' },
Expand Down

0 comments on commit 2961029

Please sign in to comment.