@@ -137,15 +137,17 @@ function karmaCreateConfig(reporters, configFileName) {
137
137
return JSON . stringify ( value , null , 2 ) . replace ( / \" / g, '\'' ) ;
138
138
}
139
139
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
+ }
149
151
done ( ) ;
150
152
}
151
153
return through . obj ( transformFn , flushFn ) ;
0 commit comments