-
Notifications
You must be signed in to change notification settings - Fork 65
Expand file tree
/
Copy pathtest.js
More file actions
32 lines (27 loc) · 1.14 KB
/
test.js
File metadata and controls
32 lines (27 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var gulp = require('gulp');
var mocha = require('gulp-mocha');
var istanbul = require('gulp-istanbul');
var gulpIf = require('gulp-if');
var argv = require('yargs').argv;
var CONFIG = require('../tasks/config');
var devMode = argv.dev ? true : CONFIG.SHOW_OUTPUT;
var reportMode = devMode ? 'spec' : 'nyan';
require('coffee-script/register');
/* Run all tests and produce coverage report */
gulp.task('test', function (cb) {
gulp.src(['client-side-source/**/*.js', 'main.js'])
.pipe(istanbul()) // Covering files
.pipe(istanbul.hookRequire()) // Force `require` to return covered files
.on('finish', function () {
gulp.src(['test/*.{js,coffee}'])
.pipe(mocha({reporter: reportMode}))
.pipe(gulpIf(devMode, istanbul.writeReports({dir: './reports/coverage-reports'})))
.pipe(istanbul.enforceThresholds({ thresholds: { global: 90 } })) // Enforce a coverage of at least 90%
.on('end', cb);
});
});
/* Run Mocha tests */
gulp.task('mocha', function () {
return gulp.src('test/*.{js,coffee}')
.pipe(mocha({reporter: 'list'}));
});