Example #1
0
gulp.task('test', ['test.instrument'], function test() {
  return gulp
    .src(['test/**/*.test.js'])
    .pipe(mocha())
    .pipe(istanbul.writeReports({
      dir: './dist/test-report'
    }))
    .pipe(notify({
      title: info.name,
      message: 'Tests done'
    }))
  ;
});
Example #2
0
 .on('finish', function() {
     gulp.src(['test/setup/integration.js', '**/_integration_/*_test.js'])
         .pipe(mocha({
             reporter: 'spec'
         }))
         .pipe(istanbul.writeReports({
             dir: COVERAGE_DIR,
             reporters: ['json', 'text'],
             reportOpts: {
                 json: {dir: JSON_COVERAGE_DIR, file: 'integration.json'}
             }
         })).on('end', cb);
 });
Example #3
0
 setTimeout(function() {
     return gulp.src(['tests/*-tests.js'], {
             read: false
         })
         .pipe(gulpMocha({
             reporter: 'spec'
         }))
         // Creating the reports after tests ran
         .pipe(istanbul.writeReports())
         .pipe(istanbul.enforceThresholds({
             thresholds: false
         }));
 }, 100);
Example #4
0
gulp.task('mochaAndIstanbul', function () {
  return gulp.src('./test/startTest.js', {
      read: false
    })
    .pipe(mocha({
      reporter: 'spec'
    }))
    .pipe(istanbul.writeReports())
    .pipe(istanbul.enforceThresholds({thresholds: {global: 100}}))
    .on('error', function (error) {
      throw error;
    });
});
			.on('finish', () => {
				return gulp
					.src(['./test/lib/**/*.js'])
					.pipe(mocha({ reporter : 'spec' })
						.on('error', function (err) {
								if (err.showStack) {
									gulpUtil.log(err);
								}

								this.emit('end');
						}))
					.pipe(istanbul.writeReports('./reports'))
			});
Example #6
0
 .on('finish', function() {
   gulp.src('./tests/server/**/*.js', {
       read: false
     })
     .pipe(mocha({
       reporter: 'spec'
     }))
     .pipe(istanbul.writeReports({
       dir: './coverage/server/',
       reporters: ['html', 'text']
     }))
     .on('end', done);
 });
gulp.task('test-cov', ['istanbul-pre-test'], function () {
  return gulp.src(TEST_FILE)
    .pipe(mocha(MOCHA_OPTS))
    .pipe(istanbul.writeReports())
    .once('error', function (err) {
      cleanFiles(FILES_TO_CLEAN);
      console.error(err.stack);
      process.exit(1);
    })
    .once('end', function () {
      cleanFiles(FILES_TO_CLEAN);
      process.exit();
    });
});
Example #8
0
gulp.task('test-coverage', ['instrument'], function() {
    return gulp_test()
        .pipe(istanbul.writeReports())
        .pipe(istanbul.enforceThresholds({
            thresholds: {
                global: {
                    statements: 100,
                    branches: 100,
                    functions: 100,
                    lines: 100
                }
            }
        }));
});
gulp.task('tests', function (cb) {
    var mochaErr;

    gulp.src('test/index.js')
        .pipe(plumber())
        .pipe(mocha({ reporter: 'spec' }))
        .on('error', function (err) {
            mochaErr = err;
        })
        .pipe(istanbul.writeReports())
        .on('end', function () {
            cb(mochaErr);
        });
});
Example #10
0
gulp.task('nodeunit', ['pre-test'], () =>
  gulp
    .src('test/**/*.test.js')
    .pipe(nodeunit({
      reporter: 'junit',
      reporterOptions: {
        output: 'test'
      }
    }))
    .pipe(istanbul.writeReports({
      dir: './test/coverage',
      reporters: ['json', 'text']
    }))
    .pipe(istanbul.enforceThresholds({ thresholds: { global: 75 } }))
gulp.task('test', ['pre-test'], function (cb) {
    let 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);
        });
});
Example #12
0
gulp.task('test-coverage', ['peg', 'juttle-spec', 'instrument'], function() {
    return gulp_test()
        .pipe(istanbul.writeReports())
        .pipe(istanbul.enforceThresholds({
            thresholds: {
                global: {
                    statements: 92,
                    branches: 87,
                    functions: 91,
                    lines: 92
                }
            }
        }));
});
Example #13
0
gulp.task('test', ['lint', 'pre-test'], (cb) => {
  let mochaErr;

  gulp.src('test/**/*.js')
    .pipe(plumber())
    .pipe(mocha({ reporter: 'spec' }))
    .on('error', (err) => {
      mochaErr = err;
    })
    .pipe(istanbul.writeReports())
    .on('end', () => {
      cb(mochaErr);
    });
});
Example #14
0
gulp.task("build-coverage", ["set-test-node-env", "pre-coverage"], function () {
  return gulp.src("dist/**/*.spec.js", {read: false})
    .pipe(mocha({
      reporter: "dot",
      require: ["source-map-support/register"]
    }))
    .pipe(istanbul.writeReports({
      reporters: [ /*"lcov",*/ "json" ],
      reportOpts: {
        //lcov: {dir: "dist/coverage/html", file: "lcov.info" },
        json: {dir: "dist/coverage/json", file: "coverage.json" }
      }
    }));
});
gulp.task('test', ['pre-test'], () => (
  gulp.src(testFiles, { read: false })
    .pipe(mocha({
      reporter: 'spec',
    }))
    .pipe(istanbul.writeReports())
    .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } }))
    .once('error', () => {
      process.exit(1);
    })
    .once('end', () => {
      process.exit();
    })
));
Example #16
0
 .on('finish', function () {
   gulp.src(['test/*.js'])
     .pipe(plumber())
     .pipe(mocha({
       reporter: 'spec'
     }))
     .on('error', function (err) {
       mochaErr = err;
     })
     .pipe(istanbul.writeReports())
     .on('end', function () {
       cb(mochaErr);
     });
 });
Example #17
0
gulp.task('test-cov', ['istanbul-pre-test'], function () {
  gulp.src(['test/*.js', 'test/support/*.js'])
    .pipe(mocha({
      reporter: REPORTER
    }))
    .pipe(istanbul.writeReports())
    .once('error', function (err) {
      console.error(err);
      process.exit(1);
    })
    .once('end', function () {
      process.exit();
    });
});
Example #18
0
gulp.task('coverage', ['pre-coverage'], () => {
  return gulp.src(['test/**/*.js'])
    .pipe(mocha())
    .pipe(istanbul.writeReports({
      reporters: [ 'lcov', 'json', 'text', 'text-summary'],
    }))
    .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } }))
    // .once('error', () => {
    //   process.exit(1);
    // })
    .once('end', () => {
      process.exit();
    });
});
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
        }))
        .on('end', cb);
});
Example #20
0
gulp.task('test-cov', ['istanbul-pre-test'], function(){
  return gulp.src('test/socket.io.js', {read: false})
    .pipe(mocha({
      reporter: 'dot'
    }))
    .pipe(istanbul.writeReports())
    .once('error', function (err){
      console.error(err.stack);
      process.exit(1);
    })
    .once('end', function (){
      process.exit();
    });
});
Example #21
0
gulp.task('test', ['lint-test', 'instrument'], function() {
  env({ vars: { NODE_ENV: 'test' } });
  return gulp.src('test/**/*.js')
    .pipe(mocha())
    .pipe(istanbul.writeReports())
    .pipe(istanbul.enforceThresholds({
      thresholds: {
        global: {
          statements: 75,
          branches: 50
        }
      }
    }));
});
 .on('finish', () => {
     gulp.src(files.mochaTests)
         .pipe(mocha({ timeout: 10000 }))
         .pipe(istanbul.writeReports({
                 reporters: [ 'lcov', 'json', 'text', 'text-summary']
         })) // Creating the reports after tests
         .pipe(istanbul.enforceThresholds({ thresholds: { global: 85 } })) // Enforce a coverage of at least 85%
         .once('error', function () {
              process.exit(1);
          })
         .once('end', function () {
             process.exit();
         });
 });
gulp.task('default', function () {
    gulp.src('tests/**/*.js')
        .pipe(mocha({
          reporter: 'mocha-junit-reporter',
          reporterOptions: {
            mochaFile: './TEST-RESULTS.xml'
          }
        }))
        .pipe(istanbul())
        .pipe(istanbul.hookRequire())
        .pipe(istanbul.writeReports({
          dir: './coverage',
          reporters: ['cobertura', 'html'] 
        }));
});
 .on('finish', function() {
     gulp.src([TEST_PATH_SERVER + '**/*.spec.js'], { read: false })
       .pipe(mocha({
         reporter: 'spec',
         globals: {
           /*should: require('should')*/
         }
       }))
       .once('error', function (err) {
         throw err;
       })
       .pipe(istanbul.writeReports({dir: './server-coverage', reporters: ['html', 'text-summary', 'text']}))
       //.pipe(istanbul.enforceThresholds({ thresholds: { global: 90 }}));   //not important for now
       .on('end', cb);
 });
Example #25
0
gulp.task('test', ['remove-files', 'require-all'], () => {
  console.log('Running tests...');
  return gulp.src(tests)
    .pipe(_jasmine({
      config: jasmineConfig,
      includeStackTrace: true,
      timeout: 1000
    }))
    .pipe(istanbul.writeReports())
    .on('end', () => {
      console.log();
      console.log('Done!');
      console.log();
    });
});
gulp.task('test', ['pre-test'], function () {
  return gulp.src('test/*.js')
    .pipe(mocha())
    .pipe(istanbul.writeReports())
    .pipe(istanbul.enforceThresholds({
      thresholds: {
        global: {
          statements: 50,
          branches: 50,
          lines: 50,
          functions: 50
        }
      }
    }));
});
gulp.task('test', ['pre-test'], function (cb) {
  var mochaErr;

  gulp.src(['test/*functional/*.js', 'test/*functional/directive/*.js'])
    .pipe(plumber())
    .pipe(mocha({reporter: 'spec'}))
    .on('error', function (err) {
      console.log(err);
      mochaErr = err;
    })
    .pipe(istanbul.writeReports())
    .on('end', function () {
      cb(mochaErr);
    });
});
Example #28
0
gulp.task( "test", ["pre-test"], cb => {

    var mochaErr;

    gulp.src( "./tests.js" )
        .pipe( plumber() )
        .pipe( mocha( { reporter : "spec" } ) )
        .on( "error", err => { mochaErr = err; } )
        .pipe( istanbul.writeReports( {
            reporters : ["lcov"],
            reportOpts : { dir : "./coverage" }
        } ) )
        .on( "end", () => {cb( mochaErr )} );

} );
gulp.task('test-inner', () => {
    return gulp.src('test/**/*.js')
    .pipe(babel())
    .pipe(mocha({
        reporter: 'list'
    }))
    // Creating the reports after tests ran
    .pipe(istanbul.writeReports({
        reporters: ['json', 'html'],
        reportOpts: {
            html: {dir: 'coverage/build/html'},
            json: {dir: 'coverage/build/json', file: 'coverage.json'}
        }
    }));
});
Example #30
0
 .on('finish', function () {
   gulp.src(['spec/**/*Spec.js'])
     .pipe(jasmine())
     .pipe(istanbul.writeReports()) // Creating the reports after tests ran
     .pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })) // Enforce a coverage of at least 90%
     .on('error', function (err) {
       console.log(err.message);
       process.exit(1);
     })
     .on('end', function () {
       cb();
       process.exit(0);
     })
   ;
 });