redoc/build/tasks/test.js

37 lines
1.1 KiB
JavaScript
Raw Normal View History

2015-12-10 00:46:27 +03:00
var gulp = require('gulp');
var Server = require('karma').Server;
2016-06-16 15:44:14 +03:00
var remapIstanbul = require('remap-istanbul/lib/gulpRemapIstanbul');
2015-12-10 00:46:27 +03:00
/**
* Run test once and exit
*/
2016-05-20 22:56:10 +03:00
gulp.task('test', ['concatPrism', 'inlineTemplates', 'injectVersionFile'], function (done) {
2015-12-10 00:46:27 +03:00
new Server({
configFile: __dirname + '/../../karma.conf.js',
singleRun: true
2016-06-16 15:44:14 +03:00
}, karmaDone).start();
function karmaDone (exitCode) {
remapCoverage(done, exitCode);
}
2015-12-10 00:46:27 +03:00
});
2016-06-16 15:44:14 +03:00
function remapCoverage(done, statusCode) {
console.log('Remapping coverage to TypeScript format...');
gulp.src('coverage/**/coverage-final.json')
.pipe(remapIstanbul({
reports: {
'lcovonly': 'coverage/remap/lcov.info',
'text-summary': 'coverage/remap/text-summary.txt',
'html': 'coverage/remap'
}
}))
.on('finish', function () {
console.log('Remapping done!');
console.log(cat('coverage/remap/text-summary.txt').stdout);
console.log('Test Done with exit code: ' + statusCode);
done(statusCode);
});
};