import gulp from 'gulp'; import {Server as Karma} from 'karma'; import {CLIOptions} from 'aurelia-cli'; import jest from 'gulp-jest'; // TODO: add coverage options function testUI(done) { let karamConfig = { configFile: __dirname + '/../../karma.conf.js' }; if (CLIOptions.hasFlag('watch')) { karamConfig.singleRun = false; karamConfig.specReporter = { showSpecTiming: true, suppressSkipped: true, suppressErrorSummary: false }; } new Karma(karamConfig, done).start(); } function testBusinessLogic() { return gulp.src('src').pipe(jest({ config: { 'verbose': true, 'testRegex': '(util|lib|value-converters).*.spec.js$', 'collectCoverage': true, 'coverageDirectory': '../coverage', 'coverageReporters': ['html', 'clover'] } })); } export default function test(done) { if (CLIOptions.hasFlag('bl')) { return testBusinessLogic(); } else if (CLIOptions.hasFlag('ui')) { return testUI(done); } return gulp.series( testBusinessLogic, testUI )(); }