2016-06-02 7 views
1

これは、ノードモンを使用して特定のポートでアプリケーションを起動し、テストを実行し、実行中のアプリケーションを停止していつでも再実行できるという考えです。Gulp経由でノードモンを実行しないようにする

gulp.task('test', function(cb) { 
    nodemon({ 
     script: 'server.js', 
     env: { 
      'NODE_ENV': 'test' 
     } 
    }); 

    // Run tests.... 


    // Stop the application and exit running Gulp -> How to do this? 
}); 

実行中のgulpを停止または強制する方法はありますか?

おかげで、

ケビン

答えて

0

私は、これらの

require('shelljs/global'); // https://github.com/shelljs/shelljs 

gulp.task('test', ['nodemon-test', 'mocha-test']); 

gulp.task('nodemon-test', function(cb) { 
    nodemon({ 
     script: 'server.js', 
     env: { 
      'NODE_ENV': 'test' 
     } 
    }) 
    .on('start', function() { 
     cb(); 
    }) 
}); 

gulp.task('mocha-test', ['nodemon-test'], function() { 
    exit(1); 
}); 
でそれを得ました
関連する問題