Skip to content

Instantly share code, notes, and snippets.

@lazd
Created December 14, 2013 20:18
Show Gist options
  • Save lazd/7964385 to your computer and use it in GitHub Desktop.
Save lazd/7964385 to your computer and use it in GitHub Desktop.
test case for execify/1
var gulp = require('gulp');
var es = require('event-stream');
var path = require('path');
var filePath = path.join(__dirname, 'gulpfile.js');
var expectedFile;
function plugalug() {
return es.map(function(file, cb) {
if (typeof file === 'undefined') {
throw new Error('File was undefined!');
}
else {
expectedFile = file;
}
cb(null, file);
});
}
gulp.task('test', function() {
var stream = gulp.src(filePath)
.pipe(plugalug());
stream.once('end', function() {
console.assert(expectedFile, 'File should be defined');
console.assert(expectedFile.path === filePath, 'Path should be correct');
console.log('Stream ended and all is well!');
});
return stream;
})
gulp.task('default', function() {
gulp.run('test')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment