-
Notifications
You must be signed in to change notification settings - Fork 82
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
Running serveral istanbul tasks at the same time #39
Comments
Well, I'd need more detail about what is happening in order to help you... Did you defined differents coverage variable names? |
I did attempt using different If I understand your second question correctly, I was using the content returned by the streams. In case it helps, here is the relevant code from my tasks. (I left out defining gulp.task( 'test', ['serverUnitTests','clientUnitTests'] );
gulp.task('clientUnitTests', function(callback) {
var coverageVar = '$$client_cov_' + new Date().getTime() + '$$';
gulp.src( [config.client.js.src + '/**/*.js'] )
// Instrument source code
.pipe( istanbul({
coverageVariable: coverageVar
}) )
.on('finish', function (){
// Load tests into mocha
gulp.src( [config.client.js.unitTests + '/**/*_test.js'] )
.pipe(
mocha({
reporter: 'spec'
})
.on( 'error', handleError )
)
// Create coverage reports
.pipe(istanbul.writeReports({
dir: config.client.root + '/coverage',
reporters: ['html', 'lcov', 'text-summary', 'json'],
reportOpts: {
dir: config.client.root + '/coverage'
},
coverageVariable: coverageVar
}))
// Throw error if coverage thresholds not met
.pipe( istanbulEnforcer(enforcerOptions) )
.on( 'error', handleError )
.on( 'end', callback );
});
});
gulp.task('serverUnitTests', function(callback) {
var coverageVar = '$$server_cov_' + new Date().getTime() + '$$';
gulp.src( [config.server.src + '/*.js', config.server.src + '/**/*.js'] )
// Instrument source code
.pipe(
istanbul({
coverageVariable: coverageVar
})
)
.on('finish', function (){
// Load tests into mocha
gulp.src( [config.server.unitTests + '/*_test.js', config.server.unitTests + '/**/*_test.js'] )
.pipe(
mocha({
reporter: 'spec'
})
.on( 'error', handleError )
)
// Create coverage reports
.pipe(istanbul.writeReports({
dir: config.server.root + '/coverage',
reporters: ['html', 'lcov', 'text-summary', 'json'],
reportOpts: {
dir: config.server.root + '/coverage'
},
coverageVariable: coverageVar
}))
// Throw error if coverage thresholds not met
.pipe( istanbulEnforcer(enforcerOptions) )
.on( 'error', handleError )
.on( 'end', callback );
});
});
|
My scenario is the same and I'm experiencing the same issue. |
Can one of your create a standalone repository on github reproducing the issue. If I can run and see what's wrong it'll help. |
What's wrong is https://github.com/SBoudrias/gulp-istanbul/blob/master/index.js#L18 The |
+1 for this fix. I run into an issue where files from the previous run are getting included in a later run via a gulp pipeline. +1 for @robrich's comment. |
I have a project that contains both client-side (browserify) code and server-side code, each with separate unit tests. If I try to run istanbul with both tests in parallel, one seem to end up superseding the other. In other words, both coverage reports end up being identical, with only the client-side tests included.
I'm not entirely sure if this is an issue. I may simply not understand how to accomplish parallel istanbul tasks or this was intentional in the design of istanbul.
This isn't a major problem as my workaround for this has been to use
run-squence
to prevent the tasks from running in parallel:I am mostly just curious if there is a better way to do this.
The text was updated successfully, but these errors were encountered: