Skip to content

Commit 483e19e

Browse files
committed
Update: Add integration test for async-once usage coupled with bach
1 parent 4077129 commit 483e19e

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
},
2323
"homepage": "https://github.com/phated/undertaker",
2424
"devDependencies": {
25+
"async-once": "^1.0.0",
2526
"code": "^1.2.1",
27+
"del": "^1.1.1",
2628
"gulp-jshint": "^1.8.4",
2729
"lab": "^5.2.0",
2830
"once": "^1.3.1",

test/integration.js

+24
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ var vinyl = require('vinyl-fs');
1414
var jshint = require('gulp-jshint');
1515
var spawn = require('child_process').spawn;
1616
var once = require('once');
17+
var aOnce = require('async-once');
18+
var del = require('del');
1719
var promisedDel = require('promised-del');
1820
var through = require('through2');
1921

@@ -83,6 +85,28 @@ describe('integrations', function() {
8385
});
8486
});
8587

88+
it('should run dependencies once', function(done) {
89+
var count = 0;
90+
91+
taker.task('clean', aOnce(function(cb) {
92+
console.log(cb());
93+
count++;
94+
del(['./fixtures/some-build.txt'], {cwd: __dirname}, cb);
95+
}));
96+
97+
taker.task('build-this', taker.series(['clean', function(done){done();}]));
98+
taker.task('build-that', taker.series(['clean', function(done){done();}]));
99+
taker.task('build', taker.series([
100+
'clean',
101+
taker.parallel(['build-this', 'build-that'])
102+
]));
103+
104+
taker.parallel('build')(function(err){
105+
expect(count).to.equal(1);
106+
done(err);
107+
});
108+
});
109+
86110
it('can use lastRun with vinyl.src `since` option', function(done){
87111
taker.task('test', function () {
88112
return vinyl.src('./fixtures/test.js', {cwd: __dirname })

0 commit comments

Comments
 (0)