gulp.task('test:coverage', (done) => {
   if (options.testPaths) {
     gulp.src(options.jsAssets)
       .pipe(istanbul({
         instrumenter: require('isparta').Instrumenter,
         includeUntested: true
       }))
       .pipe(istanbul.hookRequire()).on('finish', () => {
         gulp.src(options.testPaths)
           .pipe(envs)
           .pipe(tape({
             reporter: tapSpec(),
             bail: true
           }))
           .on('error', (error) => {
             gutil.log(error.message);
             process.exit(1);
           })
           .pipe(envs.reset)
           .pipe(istanbul.writeReports({
             dir: './coverage',
             reporters: ['lcov']
           })).on('end', () => {
             console.log('Test coverage report available at coverage/lcov-report/index.html');
             done();
           });
       });
   } else {
     done();
   }
 });
Example #2
0
gulp.task('pre-test', function () {
  return gulp.src(config.src)
    // Covering files
    .pipe(istanbul({includeUntested: true}))
    // Force `require` to return covered files
    .pipe(istanbul.hookRequire())
})
Example #3
0
gulp.task('coverage',['build'], ()=> {
  return gulp.src(paths.src).pipe(istanbul(opts))
    .on('finish', ()=> {
      gulp.src(paths.tests)
        .pipe(mochaPhantomJS({reporter: 'spec'}))
        .pipe(istanbul.writeReports(opts));
    })
    .on('error', gutil.log);
})
gulp.task('mocha', function mochaRun(cb) {
	gulp.src(config.paths.js)
		.pipe(istanbul())
		.pipe(istanbul.hookRequire())
		.on('finish', function runTests() {
			gulp.src(config.paths.test)
				.pipe(babel())
				.pipe(mocha())
				.pipe(istanbul.writeReports())
				.on('end', CheckCoverage)
				.on('end', cb)
				.on('error', onError);
		});
});
Example #5
0
gulp.task('coverage', function (cb) {
  const envs = env.set({
    TEST_RUN: true
  })
  gulp.src('./app/core/**/*.js')
    .pipe(envs)
    .pipe(istanbul())
    .pipe(istanbul.hookRequire())
    .on('finish', function () {
      gulp.src('test/*.js')
        .pipe(babel())
        .pipe(injectModules())
        .pipe(mocha())
        .pipe(istanbul.writeReports())
        .on('end', cb)
    })
})
Example #6
0
gulp.task("test-coverage", ["build"], callback => {
	gulp.src(paths.source.javascript)
		.pipe(istanbul()) // Covering files
		.pipe(istanbul.hookRequire()) // Force `require` to return covered files
		.on("finish", () => {
			gulp.src(paths.source.allSpec)
				.pipe(mocha())
				.pipe(istanbul.writeReports({dir: `${__dirname}/../coverage`, reporters: ["html", "text"]})) // Creating the reports after tests ran
				// .pipe(istanbul.enforceThresholds({ thresholds: { global: 100 } })) // Enforce a coverage of 100%
				.once("end", error => {
					callback(error);
					// Required to end the test due to
					// interactive CLI testing
					process.exit(0);
				});
		});
});
gulp.task('pre-test', () => gulp.src(files.src)
    .pipe(istanbul({
      includeUntested: true,
    }))
    .pipe(istanbul.hookRequire())