Skip to content

Commit f72a1a9

Browse files
author
benholloway
committed
fixed build fail where karama.conf.js is not present
1 parent a3de51b commit f72a1a9

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

lib/test/karma.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)