Created
December 14, 2013 20:18
-
-
Save lazd/7964385 to your computer and use it in GitHub Desktop.
test case for execify/1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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