mirror of
https://gitlab.silvrtree.co.uk/martind2000/ft.git
synced 2025-02-11 12:49:16 +00:00
46 lines
1.0 KiB
JavaScript
46 lines
1.0 KiB
JavaScript
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
|
|
)();
|
|
}
|