Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed May 18, 2019
1 parent 5ad883b commit 0528c3d
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/helpers/gulpfiles/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ export const severalFiles = () =>
.pipe(stream(() => command, opts))
.pipe(through.obj(execVinyl))

// Should allow doing several times
export const severalTimes = () =>
src(DUMMY, { buffer })
.pipe(stream(() => command, opts))
.pipe(stream(() => command, opts))
.pipe(through.obj(execVinyl))

// `input` should be a function
export const inputNotFunc = () =>
src(DUMMY, { buffer }).pipe(stream(command, opts))
Expand Down
63 changes: 63 additions & 0 deletions test/snapshots/stream.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -463,3 +463,66 @@ Generated by [AVA](https://ava.li).
[12:00:00] Finished 'main' after 100 ms`,
}

## stream() | stream-buffer { task: 'severalTimes' }

> Snapshot 1
{
exitCode: 0,
stderr: '',
stdout: `[12:00:00] Starting 'severalTimes'...␊
test␊
[12:00:00] Finished 'severalTimes' after 100 ms`,
}

## stream() | stream-save { task: 'severalTimes' }

> Snapshot 1
{
exitCode: 0,
stderr: '',
stdout: `[12:00:00] Starting 'severalTimes'...␊
[␊
{␊
"command": "echo test",␊
"exitCode": 0,␊
"exitCodeName": "SUCCESS",␊
"stdout": "test",␊
"stderr": "",␊
"all": "test",␊
"failed": false,␊
"timedOut": false,␊
"isCanceled": false,␊
"killed": false␊
},␊
{␊
"command": "echo test",␊
"exitCode": 0,␊
"exitCodeName": "SUCCESS",␊
"stdout": "test",␊
"stderr": "",␊
"all": "test",␊
"failed": false,␊
"timedOut": false,␊
"isCanceled": false,␊
"killed": false␊
}␊
]␊
[12:00:00] Finished 'severalTimes' after 100 ms`,
}

## stream() | stream-stream { task: 'severalTimes' }

> Snapshot 1
{
exitCode: 0,
stderr: '',
stdout: `[12:00:00] Starting 'severalTimes'...␊
test␊
[12:00:00] Finished 'severalTimes' after 100 ms`,
}
Binary file modified test/snapshots/stream.js.snap
Binary file not shown.
1 change: 1 addition & 0 deletions test/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ testEach(
{ task: 'inputFile', command: 'echo' },
{ task: 'inputUndefined' },
{ task: 'severalFiles' },
{ task: 'severalTimes' },
{},
{ opts: { encoding: 'utf8' } },
{ opts: { stripFinalNewline: true } },
Expand Down

0 comments on commit 0528c3d

Please sign in to comment.