module.exports = function() { return gulp.src(__appdir + '/src/test/e2e/**/*.js') .pipe(protractor({ configFile: __appdir + '/src/test/protractor.js', args: [ '--baseUrl', 'http://localhost:8080/' ], autoStartStopServer: true, debug: true })) .on('error', utils.log) // Creating the reports after tests ran .pipe(istanbul.writeReports({ dir: __appdir + '/target/reports/coverage', reporters: [ 'json' ] })) // Enforce a coverage of at least 90% .pipe(istanbul.enforceThresholds({ thresholds: { global: 0 } })) .once('end', function() { process.exit(); }); };
gulp.task('test',['pre-test'], function() { gulp.src('./test/test.js', {read: false}) .pipe(mocha()) .pipe(istanbul.writeReports()) // Enforce a coverage of at least 90% .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })); });
.on('finish', function () { gulp.src(['./lib/__tests__/*.js']) .pipe(mocha({reporter: 'nyan'})) .pipe(istanbul.writeReports()) // Creating the reports after tests runned .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })) // Enforce a coverage of at least 90% .on('end', cb); });
.on('finish', function() { gulp.src(['./test/*.js']) .pipe(mocha()) .pipe(istanbul.writeReports()) .pipe(istanbul.enforceThresholds({ thresholds: { global: 80 } })) .on('end', cb); });
gulp.task("test::test-base", function() { if (type === TYPE_DEV) { return gulp .src(Paths.getPath("tests") + "/index.js", { read : false }) .pipe(mocha({ ui : "exports" })) .pipe(coverage.writeReports({ dir : Paths.getPath("root") + "/coverage" })) .pipe(coverage.enforceThresholds({ thresholds : { global : 100 // enforce 100% coverage } })); } else { return gulp .src(Paths.getPath("tests") + "/index.js", { read : false }) .pipe(mocha({ ui : "exports" })); } });
gulp.task('cov', ['pre-cov'], () => { process.env.NOCK_BACK_MODE = 'lockdown'; return gulp.src([test_files], { read: false }) .pipe(mocha_istanbul({ reporter: 'dot' })) .pipe(istanbul.writeReports()) .pipe(istanbul.enforceThresholds({ thresholds: { global: min_coverage } })); });
gulp.task('run-unit-tests', ['pre-unit-tests'], function(cb) { gulp.src(gulpConfig.javascriptUnitTests) .pipe(mocha({ ui: mochaConfig.unitTestMochaInterface, timeout: mochaConfig.unitTestTimeout, reporter: mochaConfig.unitTestReporter, reporterOptions: mochaConfig.unitTestReporterOptions })) .pipe(istanbul.writeReports({ reporters: istanbulConfig.reporters, dir: istanbulConfig.unitTestCoverageDirectory })) .pipe(istanbul.enforceThresholds({ thresholds: { global: { statements: istanbulConfig.unitTestGlobalThresholds.statementCoverageThreshold, branches: istanbulConfig.unitTestGlobalThresholds.branchCoverageThreshold, lines: istanbulConfig.unitTestGlobalThresholds.lineCoverageThreshold, functions: istanbulConfig.unitTestGlobalThresholds.functionCoverageThreshold }, local: { statements: istanbulConfig.unitTestLocalThresholds.statementCoverageThreshold, branches: istanbulConfig.unitTestLocalThresholds.branchCoverageThreshold, lines: istanbulConfig.unitTestLocalThresholds.lineCoverageThreshold, functions: istanbulConfig.unitTestLocalThresholds.functionCoverageThreshold } } })) .on('end', cb); });
gulp.task('test', ['pre-test'], function() { return gulp .src(['src/**/*.spec.js','src/**/*.js']) .pipe(mocha()) .pipe(istanbul.writeReports()) .pipe(istanbul.enforceThresholds({thresholds: {global: 80}})); });
function() { vars.path = '../src/js-partial-stod.js'; return gulp .src( '../../tests/tests.js', { read : false } ) .pipe( mocha({ ui : 'exports' }) ) .pipe( coverage.writeReports({ dir : '../../cov' }) ) .pipe( coverage.enforceThresholds({ thresholds : { global : 100 // enforce 100% coverage } } )); }
.on( 'finish', function () { gulp.src( paths.test, { 'read' : false } ) .pipe( mocha( mochaOptions ).on( 'error', function ( mochaError ) { console.log( mochaError ); process.exit( 1 ); } ) ) .pipe( istanbul.writeReports( { 'dir' : paths.coverage, 'reporters' : enforcement.reporters, 'reportOpts' : { 'dir' : paths.coverage, 'watermarks' : enforcement.watermarks } } ) ) .pipe( istanbul.enforceThresholds( covEnforcerOpts ).on( 'error', function () { console.log( 'error - coverage enforcer' ); enforcement.log(); process.exit( 1 ); } ) ) .on( 'error', function () { process.exit( 1 ); } ) .on( 'end', function () { enforcement.log(); process.exit(); } ); } );
gulp.task('test-unit', ['lint', 'pre-test-unit'], function testUnit() { return gulp .src(specPaths) .pipe(mocha()) .pipe(istanbul.writeReports({ reporters: ['text', 'lcovonly', 'html', 'json', 'text-summary'], reportOpts: { dir: './coverage', lcov: { dir: 'coverage/lcovonly', file: 'lcov.info' }, html: { dir: 'coverage/html' }, json: { dir: 'coverage/json' } } })) .pipe(istanbul.enforceThresholds({ thresholds: { global: { statements: 70, branches: 45 } } })) .pipe(exit()); });
gulp.task('test', ['pre-test'], () => { return gulp.src('test/**/*.js') .pipe(babel()) .pipe(mocha({reporter: 'spec'})) .pipe(istanbul.writeReports()) .pipe(istanbul.enforceThresholds({thresholds: {global: 90}})); });
function test() { return gulp.src(['spec/**/*-spec.js']) .pipe(jasmine()) .pipe(istanbul.writeReports()) .pipe(istanbul.enforceThresholds({thresholds: {global: 90}})); }
gulp.task('test', ['pre-test'], function () { return gulp.src(['tests/*.js']) .pipe(mocha()) // Creating the reports after tests ran .pipe(istanbul.writeReports()) // Enforce a coverage of at least 90% .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })); });
.on('finish', function() { gulp.src('src/test/**/*.spec.js') .pipe(mocha(config_mocha)) .pipe(istanbul.writeReports()) .pipe(istanbul.enforceThresholds(config_istanbul_thresholds)) .on('error', utils.log) .on('end', done); })
gulp.task('test', ['pre-test'], function () { return gulp.src('./test/**/*.js', { read: false }) .pipe(gmocha({ timeout: 10000 })) .once('error', abort) .pipe(istanbul.writeReports()) .pipe(istanbul.enforceThresholds({ thresholds: { statements: 80 } })) .once('error', abort); });
gulp.task('test', ['pre-test'], () => ( gulp.src(testFiles, { read: false }) .pipe(mocha({ reporter: 'spec', })) .pipe(istanbul.writeReports()) .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })) ));
gulp.task("mocha", [ "coveralls" ], () => { return gulp.src(UNITTESTS_FILES) .pipe(plumber()) .pipe(mocha()) .pipe(istanbul.writeReports()) .pipe(istanbul.enforceThresholds({ "thresholds": { "global": 75 } })); });
gulp.task('coverage', ['pre-coverage', 'test'], function () { return gulp.src(cliSrc || config.paths.specs) // Creating the reports after tests ran .pipe(istanbul.writeReports()) // Enforce a coverage of at least 90% .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })); });
gulp.task('test', ['pre-test'], function () { return gulp.src(['test/*.js']) .pipe(mocha()) // Creating the reports after tests ran .pipe(istanbul.writeReports({ reporters: ['lcov', 'json', 'text', 'text-summary'] })) // Enforce a coverage of at least 80% .pipe(istanbul.enforceThresholds({ thresholds: { global: 80 } })); });
.on("finish", function () { var stream = Gulp.src(paths.test) .pipe(new Mocha()) .pipe(Istanbul.writeReports()) .pipe(Istanbul.enforceThresholds({ thresholds : thresholds })) .on("end", done) .on("error", done); consume(stream); });
gulp.task("exec-test", function () { console.log("Executing tests ..."); return gulp.src("./test/Test.js") .pipe(mocha()) .pipe(istambul.writeReports({ reporters: [ 'html', 'text', 'text-summary'], })) .pipe(istambul.enforceThresholds({ thresholds: { global: 30 } })); });
.on('finish', function(){ gulp.src(TEST_FILE) .pipe(mocha({reporter:"dot"})) .on("error", cb) .pipe(istanbul.writeReports({ coverageVariable: coverageVariable, reporters: ['lcov','text-summary'] })) .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })) .on('finish', cb); });
gulp.task('test', function (done) { return merge( gulp.src('thunks.js') .pipe(istanbul()) // Covering files .pipe(istanbul.hookRequire()), // Force `require` to return covered files gulp.src('test/index.js') .pipe(mocha({timeout: 60000})) .pipe(istanbul.writeReports()) // Creating the reports after tests runned .pipe(istanbul.enforceThresholds({thresholds: {global: 85}})) // Enforce a coverage of at least 85% ) })
gulp.task('mocha',['istanbul'], function () { return gulp.src('./test/*.js', {read: false}) // gulp-mocha needs filepaths so you can't have any plugins before it // .pipe(mocha({reporter: 'nyan'})); .pipe(mocha()) // Creating the reports after tests ran .pipe(istanbul.writeReports()) // Enforce a coverage of at least 70% .pipe(istanbul.enforceThresholds({ thresholds: { global: 70 }})); });
.on("finish", function () { gulp.src([ "test/*.js" ], { read : false }) .pipe(mocha({ reporter : "spec", globals : { should : require("should") } })) .pipe(istanbul.writeReports()) .pipe(istanbul.enforceThresholds({ thresholds : { global : 100 } })); });
gulp.task('test', ['pre-test'], function () { return gulp.src(['test/**/*.js']) .pipe(mocha({ timeout: 60000 // 1 minute })) // Creating the reports after tests ran .pipe(istanbul.writeReports({ reporters: ['html', 'text-summary'] })) // Enforce a coverage of at least 70% .pipe(istanbul.enforceThresholds({ thresholds: { global: 70 } })); });
.on('finish', function () { gulp.src(['src/**/*.spec.js']) .pipe(mocha()) .pipe(istanbul.writeReports( { dir: './build/coverage', reportOpts: { dir: './build/coverage' } } )) // Creating the reports after tests ran .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })) // Enforce a coverage of at least 90% .on('end', cb); });
gulp.task("mocha", function() { return gulp.src(tests) .pipe(mocha()) .pipe(istanbul.writeReports()) .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })).once("error", function() { }); });
.on('finish', function () { gulp.src(['./src/test/**/*.spec.js']) .pipe(mocha({ reporter: 'mochawesome', reporterOptions: { reportDir: 'build/reports/unit-test', reportName: 'unit-test-report' } })) .pipe(istanbul.writeReports({dir: 'build/coverage/unit-test'})) .pipe(istanbul.enforceThresholds({thresholds: {global: 10}})) .on('end', cb); });