gulp.task('test', ['coverage'], function() { return gulp.src('test/*.js') .pipe(mocha({reporter: 'spec'})) .pipe(istanbul.writeReports()); });
gulp.task('coverage', [ 'lint' ], function (done) { gulp.src(sources) .pipe(istanbul()) .pipe(istanbul.hookRequire()) .on('error', errorHandler) .on('finish', function () { gulp.src('test/**/*.js') .pipe(mocha()) .pipe(istanbul.writeReports({ dir: 'dist/coverage/' })) .on('finish', done); }); });
gulp.task('test', 'Run tests', ['pre-test'], function () { process.env.UNIT_TESTING = true; process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; return gulp.src('src/**/*.spec.js', {read: false}) // gulp-mocha needs filepaths so you can't have any plugins before it .pipe(mocha({reporter: 'spec'})) .pipe(istanbul.writeReports()) // Enforce a coverage of at least 90% .pipe(istanbul.enforceThresholds({thresholds: {global: 80}})); });
gulp.task('test:mocha', ['build:all', 'pre-test'], function () { return _test() .pipe(istanbul.writeReports({ reporters: ['json'] })); });
gulp.task('test', ['pre-test'], function (cb) { var mochaErr; gulp.src('test/**/*.js') .pipe(plumber()) .pipe(mocha({reporter: 'spec'})) .on('error', function (err) { mochaErr = err; }) .pipe(istanbul.writeReports()) .on('end', function () { cb(mochaErr); }); });
gulp.task("coverage:report", () => { return gulp.src(config.test.testFiles, { read: false }) .pipe(istanbul.writeReports({ reporters: ["lcov", "json", "text", "text-summary", "html", "cobertura"], reportOpts: { lcov: { dir: "./tests/reports/lcovonly" }, json: { dir: "./tests/reports", file: "coverage.json" }, cobertura: { dir: "./tests/reports", file: "coverage.xml" }, html: { dir: "./tests/reports/html" } }, dir: "./tests/reports" })); });
gulp.task('test', ['coverage'], function() { return gulp.src('test.js') .pipe(mocha({ reporter: 'spec' })) .pipe(istanbul.writeReports()) .pipe(istanbul.writeReports({ reporters: [ 'text' ], reportOpts: {dir: 'coverage', file: 'summary.txt'} })); });
/** * Runs all tests with coverage */ gulp.task('test-coverage', 'Run all tests and generate coverage data in '+COVERAGE_DIR+' folder', ['clean-coverage'], function(cb) { var istanbul = require('gulp-istanbul'); gulp.src(['src/**/*.js']) .pipe(istanbul()) // Covering files .pipe(istanbul.hookRequire()) // Force `require` to return covered files .on('finish', function () { runTests() .pipe(istanbul.writeReports()) // Creating the reports after tests runned .on('end', cb); }); });
gulp.task('test', ['coverage'], function() { return gulp.src('test/*.js') .pipe(mocha({reporter: 'spec'})) .pipe(istanbul.writeReports()); });
gulp.task('mocha', ['coverage'], function() { return gulp.src(['test/*.js']) .pipe(mocha()) .pipe(istanbul.writeReports()); });
gulp.task('test', ['coverage'], function() { return gulp.src('test/*.js') .pipe(mocha({reporter: 'spec'})) .pipe(istanbul.writeReports()); });
gulp.task('test', ['pre-test'], function (cb) { return gulp.src([ './test/**/*.js' ]) .pipe(mocha({ reporter: 'mocha-junit-reporter', reporterOptions: { mochaFile: './test-reports/junit/results.xml' } })) .pipe(istanbul.writeReports()) // stores reports in "coverage" directory })
gulp.task('test', ['coverage'], function() { return gulp.src('test/*.js') .pipe(mocha({reporter: 'spec'})) .pipe(istanbul.writeReports()); });
gulp.task('test', ['pre-test'], function () { return gulp.src(TEST_CODE) .pipe(mocha()) // Creating the reports after tests ran .pipe(istanbul.writeReports()); });
gulp.task('test', ['pre-test'], function (cb) { var mochaErr; gulp.src('test/**/*.js') .pipe(plumber()) .pipe(mocha({reporter: 'spec'})) .on('error', function (err) { mochaErr = err; }) .pipe(istanbul.writeReports()) .on('end', function () { cb(mochaErr); }); });