-
Notifications
You must be signed in to change notification settings - Fork 41
Error on gulp 4.0 #30
Comments
Hi I think that can help you :
|
Thanks @kevincaradant! |
@kevincaradant I'm afraid that what you are proposing here is incorrect as it wouldn't correctly propagate karma's exit code to gulp / shell. As such your build would look like passing while it could be failing. One thing people could try is to do:
but I don't see how it differs from:
joowh85 @ilianaza when are you getting those |
@pkozlowski-opensource, +1, you re right, my bad, sorry for that. I didnt see before because i use it in my gulp but i never have an error yet. But i fix it for my self . |
@pkozlowski-opensource your solution did not work on my machine:
@kevincaradant your solution worked. I think the readme for this repo needs to be updated. |
@pkozlowski-opensource @kevincaradant |
@ankitmithu005 , I don't know, sorry, today, I'm using Webpack, my old template was with gulp but I don't maintain it up to date :/ Try to look on Stackoverflow, I found this (quickly without read in detail), I don't know if this can help you but in case: And to finish: |
Can't say exactly why, but this seems to work for me at the moment. Perhaps simply passing the returned error code is causing issues in the done() callback, for all I know. A message or new Error('...') on the other hand, might work just fine. That might actually be a problem with Gulp, IMHO, since information is lacking on what exactly should be passed into the done() function. Unless I missed something in their docs, of course.
But in the meantime, the README should really be updated. That page is highly visible and it took me a while to find a solution, despite the fact this issue was logged in here. |
@djabraham it is better to do only one of the two from exit or done, since we may want to continue running some follow-up tasks and if we always exit even on success that will not be possible. I have noticed flakiness where calling done before exit sometime causes exitCode 0 to be bubbled up to the caller like when running in a CI environment such as travis regardless of what the actual exitCode is. Lastly, I don't think done is designed to take any arguments, so that is certainly the root cause of the problem with this design in gulp itself as you rightly pointed out. gulp.task('unit-test', function (done) {
var karmaServer = new karma.Server({
configFile: __dirname + '/test/karma.conf.js',
singleRun: true
}, function (exitCode) {
exitCode ? process.exit(exitCode) : done();
}).start();
}); |
On gulpfile.js..
Then error.
The text was updated successfully, but these errors were encountered: