gulp-function/test/test.ts

36 lines
843 B
TypeScript
Raw Normal View History

2017-04-29 22:44:11 +00:00
import { expect, tap } from 'tapbundle'
2017-04-29 23:07:30 +00:00
import * as smartgulp from 'smartgulp'
2016-10-19 05:36:32 +00:00
let gulp = require('gulp')
2017-04-29 22:44:11 +00:00
import * as gulpFunction from '../dist/index'
2016-10-19 05:36:32 +00:00
import * as beautylog from 'beautylog'
2017-04-29 22:44:11 +00:00
let smartq = require('smartq')
2016-12-04 20:32:56 +00:00
2016-03-26 16:22:46 +00:00
2017-04-29 22:44:11 +00:00
tap.test('should run through smoothly with ' + "'forEach'", async (tools) => {
let done = smartq.defer()
let counter = 0
2017-04-29 23:07:30 +00:00
gulp.src('./test/testfiles/*.md')
2017-04-29 22:44:11 +00:00
.pipe(gulpFunction.forEach(async () => {
counter++
if (counter === 2) {
2016-10-19 05:36:32 +00:00
done.resolve()
2017-04-29 22:44:11 +00:00
}
}))
await done.promise
})
2016-03-26 16:22:46 +00:00
2017-04-29 22:44:11 +00:00
tap.test('should run through smoothly with ' + "'forEach'", async (tools) => {
let done = smartq.defer()
let counter = 0
2017-04-29 23:07:30 +00:00
smartgulp.src(['./test/testfiles/*.md'])
2017-04-29 22:44:11 +00:00
.pipe(gulpFunction.atEnd(async () => {
console.log('atEnd')
done.resolve()
}))
await done.promise
2016-10-19 05:36:32 +00:00
})
2016-03-26 16:22:46 +00:00
2017-04-29 22:44:11 +00:00
tap.start()