diff --git a/lib/config_upgrader.js b/lib/config_upgrader.js index 9a4f39004..78cb8d9a6 100644 --- a/lib/config_upgrader.js +++ b/lib/config_upgrader.js @@ -269,7 +269,11 @@ class ConfigUpgrader { return report; }); - return reports.reduce(function(a, b) { return a.concat([""]).concat(b); }); + if (reports.length > 0) { + return reports.reduce(function(a, b) { return a.concat([""]).concat(b); }); + } else { + return reports; + } } } diff --git a/test/config_upgrater_test.js b/test/config_upgrater_test.js index e6cba7123..1f1c356c0 100644 --- a/test/config_upgrater_test.js +++ b/test/config_upgrater_test.js @@ -55,6 +55,19 @@ describe("ConfigUpgrader", function() { }); }); }); + + it("doesn't care if there aren't any configs", function(done) { + temp.mkdir("code ", function(err, directory) { + if (err) { throw err; } + + process.chdir(directory); + + let report = ConfigUpgrader + .upgradeInstructions([directory + '/file.js'], directory); + expect(report).to.deep.eq([]); + done(); + }); + }); });