2016-02-27 16:45:44 +00:00
|
|
|
import gulp from 'gulp';
|
|
|
|
import istanbul from 'gulp-istanbul';
|
2017-04-29 14:52:12 +00:00
|
|
|
import { Instrumenter } from 'isparta';
|
2016-02-27 16:45:44 +00:00
|
|
|
import mocha from 'gulp-mocha';
|
2017-04-29 14:52:12 +00:00
|
|
|
import PATHS from './../helpers/src-paths';
|
2016-02-27 16:45:44 +00:00
|
|
|
|
2017-04-29 14:52:12 +00:00
|
|
|
gulp.task('mocha', (done) => {
|
|
|
|
gulp.src([PATHS.CLI_SRC_JS, '!src/cli.js'])
|
|
|
|
.pipe(istanbul({
|
|
|
|
instrumenter: Instrumenter,
|
|
|
|
includeUntested: true,
|
|
|
|
}))
|
|
|
|
.pipe(istanbul.hookRequire()) // Force `require` to return covered files
|
|
|
|
.on('finish', () => gulp.src(PATHS.TEST_SRC, { read: false })
|
|
|
|
.pipe(mocha({
|
|
|
|
compilers: 'js:babel-core/register',
|
|
|
|
recursive: true,
|
|
|
|
}))
|
|
|
|
.pipe(istanbul.writeReports({
|
|
|
|
dir: './coverage',
|
|
|
|
reporters: ['lcov'],
|
|
|
|
reportOpts: { dir: './coverage' },
|
|
|
|
}))
|
|
|
|
.on('end', done));
|
2016-02-27 16:45:44 +00:00
|
|
|
});
|
2017-04-25 15:04:57 +00:00
|
|
|
|
2017-04-29 14:52:12 +00:00
|
|
|
gulp.task('tdd', ['mocha'], () => gulp.watch(['src/**/*.js', 'test/**/*.js'], ['mocha']));
|