add coverage option

This commit is contained in:
Philipp Kunz 2017-06-16 16:08:36 +02:00
parent 2bd187b704
commit 455c89d68d
5 changed files with 33 additions and 18 deletions

8
dist/mod02/index.js vendored
View File

@ -109,12 +109,20 @@ exports.run = function (configArg) {
plugins.beautylog.ora.text('now starting tests');
plugins.beautylog.ora.end();
plugins.beautylog.log('ready for tapbuffer:');
if (configArg.coverage) {
tap(config)
.then(handleCoverageData)
.then(() => {
done.resolve(config);
}).catch(err => { console.log(err); });
}
else {
tap(config)
.then(() => {
done.resolve(config);
}).catch(err => { console.log(err); });
}
}
else {
plugins.beautylog.ora.end();
done.resolve(config);

View File

@ -7,6 +7,7 @@
export declare type npmtsMode = 'default' | 'custom' | 'merge';
export interface INpmtsConfig {
argv: any;
coverage: boolean;
coverageTreshold: number;
checkDependencies: boolean;
mode: npmtsMode;

View File

@ -7,6 +7,7 @@ exports.run = function (argvArg) {
let done = q.defer();
let defaultConfig = {
argv: undefined,
coverage: true,
coverageTreshold: 70,
checkDependencies: true,
mode: 'default',
@ -35,7 +36,6 @@ exports.run = function (argvArg) {
plugins.beautylog.error(`mode not recognised! Can be default or custom`);
process.exit(1);
}
;
// handle default mode
if (config.mode === 'default' || config.mode === 'merge') {
config.ts = {
@ -45,16 +45,13 @@ exports.run = function (argvArg) {
'./test/**/*.ts': './test/'
};
}
;
// mix with commandline
if (config.argv.notest) {
config.test = false;
}
;
if (config.argv.watch) {
config.watch = true;
}
;
plugins.beautylog.ok('build options are ready!');
done.resolve(config);
return done.promise;

View File

@ -114,12 +114,19 @@ export let run = function (configArg: INpmtsConfig) {
plugins.beautylog.ora.text('now starting tests')
plugins.beautylog.ora.end()
plugins.beautylog.log('ready for tapbuffer:')
if (configArg.coverage) {
tap(config)
.then(handleCoverageData)
.then(() => {
done.resolve(config)
}).catch(err => { console.log(err) })
} else {
tap(config)
.then(() => {
done.resolve(config)
}).catch(err => { console.log(err) })
}
} else {
plugins.beautylog.ora.end()
done.resolve(config)

View File

@ -13,6 +13,7 @@ export type npmtsMode = 'default' | 'custom' | 'merge'
export interface INpmtsConfig {
argv: any
coverage: boolean
coverageTreshold: number
checkDependencies: boolean
mode: npmtsMode
@ -31,6 +32,7 @@ export let run = function (argvArg) {
let done = q.defer()
let defaultConfig: INpmtsConfig = {
argv: undefined,
coverage: true,
coverageTreshold: 70,
checkDependencies: true,
mode: 'default',
@ -65,7 +67,7 @@ export let run = function (argvArg) {
default:
plugins.beautylog.error(`mode not recognised! Can be default or custom`)
process.exit(1)
};
}
// handle default mode
if (config.mode === 'default' || config.mode === 'merge') {
@ -75,15 +77,15 @@ export let run = function (argvArg) {
config.testTs = {
'./test/**/*.ts': './test/'
}
};
}
// mix with commandline
if (config.argv.notest) {
config.test = false
};
}
if (config.argv.watch) {
config.watch = true
};
}
plugins.beautylog.ok('build options are ready!')
done.resolve(config)