@@ -7,6 +7,8 @@ var gulp = require('gulp'),
77 querystring = require ( 'querystring' ) ,
88 childProcess = require ( 'child_process' ) ;
99
10+ var yargs = require ( '../util/yargs' ) ;
11+
1012/**
1113 * Wrap the given value in quotation marks
1214 * @param {* } value The value to wrap
@@ -17,6 +19,7 @@ function quote(value) {
1719}
1820
1921var defaultReporterName = 'angularity-karma-reporter' ;
22+
2023var filesAppendRegex = / \/ \* + \s * A N G U L A R I T Y _ F I L E _ L I S T \s * \* + \/ / ;
2124var reportersAppendRegex = / \/ \* + \s * A N G U L A R I T Y _ R E P O R T E R _ L I S T \s * \* + \/ / ;
2225var pluginsAppendRegex = / \/ \* + \s * A N G U L A R I T Y _ P L U G I N _ L I S T \s * \* + \/ / ;
@@ -200,7 +203,38 @@ function karmaRun(reporters, bannerWidth) {
200203 } ) ;
201204} ;
202205
206+ var yargsOptionDefiniton = {
207+ key : 'karmareporter' ,
208+ value : {
209+ describe : 'Specify a custom Karma reporter to use. ' +
210+ 'Either a locally npm installed module, or an asolute path to one.' ,
211+ alias : [ 'k' ] ,
212+ default : defaultReporterName ,
213+ string :true ,
214+ }
215+ } ;
216+ var checkKarmaReporter = yargs . createCheck ( )
217+ . withGate ( function ( argv ) {
218+ return ! argv . help ;
219+ } )
220+ . withTest ( {
221+ 'karmareporter' : function ( value ) {
222+ if ( typeof value === 'undefined' ) {
223+ return ;
224+ }
225+ try {
226+ getKarmaReporterPluginPath ( value ) ;
227+ }
228+ catch ( ex ) {
229+ return 'Illegal value for "reporter"\n' + ex ;
230+ }
231+ } ,
232+ } )
233+ . commit ( ) ;
234+
203235module . exports = {
204236 createConfig : karmaCreateConfig ,
205- run : karmaRun
237+ run : karmaRun ,
238+ yargsCheck : checkKarmaReporter ,
239+ yargsOption : yargsOptionDefiniton ,
206240} ;
0 commit comments