Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gulp task does not run with Stream returning dependent task #176

Closed
iainjmitchell opened this issue Jan 21, 2014 · 2 comments
Closed

Gulp task does not run with Stream returning dependent task #176

iainjmitchell opened this issue Jan 21, 2014 · 2 comments

Comments

@iainjmitchell
Copy link

From looking at the documentation on dependent tasks it should support returning streams as a mechanism of notifying of task completion. I cannot seem to get this to work.

Here is my gulp file:

var gulp = require('gulp'),
      mocha = require('gulp-mocha'),
      git = require('gulp-git');

gulp.task('mocha', function () {
    var mochaRun = mocha({
            reporter: 'nyan',
            ui: 'tdd'
        });

    return gulp
        .src('test/**/*.js')
        .pipe(mochaRun);
});

gulp.task('push', ['mocha'], function(){
    var commitMessage = gulp.env.message || 'no commit message';
    console.log('Tests passed! Pushing code...');
    return gulp
        .src('./.')
        .pipe(git.add())
        .pipe(git.commit(commitMessage))
        .pipe(git.push());
});

When the push task is run, the mocha task runs successfully but the push task never runs. I couldn't find any tests in the orchestrator project (which I assume controls this?) for this scenario either.

If I add a callback method into the mocha task and manually trigger it, then the push task does run.

@robrich
Copy link
Contributor

robrich commented Jan 21, 2014

This is weird. It sounds like the mocha plugin doesn't end the stream. That's orchestrator's queue that the task finished. Just as a test, try creating a different stream in the mocha task like:

gulp.task('mocha', function () {
    return gulp
        .src('test/**/*.js')
        .pipe(gulp.dest('deleteme'));
});

@iainjmitchell
Copy link
Author

Yes, looks like it is an issue with the mocha plugin, I tried both your example and the jshint plugin and they seem to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants