@@ -137,15 +137,17 @@ function karmaCreateConfig(reporters, configFileName) {
137137 return JSON . stringify ( value , null , 2 ) . replace ( / \" / g, '\'' ) ;
138138 }
139139 var filePath = path . resolve ( configFileName ) ;
140- var contents = fs . readFileSync ( filePath ) . toString ( )
141- . replace ( basePathRegex , encode ( process . cwd ( ) ) )
142- . replace ( filesAppendRegex , encode ( files . concat ( additional ) ) )
143- . replace ( reportersAppendRegex , encode ( reporters . map ( getKarmaReporterName ) ) )
144- . replace ( pluginsAppendRegex , '[\n' + reporters . map ( requirePlugins ) . join ( ',\n' ) + '\n]' ) ;
145- this . push ( new gutil . File ( {
146- path : filePath ,
147- contents : new Buffer ( contents )
148- } ) ) ;
140+ if ( fs . existsSync ( filePath ) ) {
141+ var contents = fs . readFileSync ( filePath ) . toString ( )
142+ . replace ( basePathRegex , encode ( process . cwd ( ) ) )
143+ . replace ( filesAppendRegex , encode ( files . concat ( additional ) ) )
144+ . replace ( reportersAppendRegex , encode ( reporters . map ( getKarmaReporterName ) ) )
145+ . replace ( pluginsAppendRegex , '[\n' + reporters . map ( requirePlugins ) . join ( ',\n' ) + '\n]' ) ;
146+ this . push ( new gutil . File ( {
147+ path : filePath ,
148+ contents : new Buffer ( contents )
149+ } ) ) ;
150+ }
149151 done ( ) ;
150152 }
151153 return through . obj ( transformFn , flushFn ) ;
0 commit comments