diff --git a/README.md b/README.md index 75620d4..906c2b9 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ npm install -g updtr -w, --wanted updates to wanted version specified in package.json instead of the modules latest version -t, --test change the command for the tests -e, --exclude exclude modules comma seperated, e.g. updtr --exclude module1,module2 + --test-stdout shows stdout if your test command fails ``` ## License diff --git a/bin/updtr b/bin/updtr index c96b70b..f48e88e 100755 --- a/bin/updtr +++ b/bin/updtr @@ -12,7 +12,7 @@ program .option("-w, --wanted", "updates to wanted version specified in package.json instead of the modules latest version") .option("-t, --test ", "change the command for the tests") .option("-e, --exclude ", "exclude modules comma seperated, e.g. updtr --exclude module1,module2", "excludes") - .option("--test-errors", "shows stdout if your test command fails"); + .option("--test-stdout", "shows stdout if your test command fails"); program.parse(process.argv); @@ -28,7 +28,7 @@ updtr.run({ wanted: program.wanted, testCmd: program.test, exclude: program.exclude, - testErrors: program.testErrors + testStdout: program.testStdout }, function (err) { if (err) { throw err; diff --git a/lib/reporters/default.js b/lib/reporters/default.js index 8b46823..5ff4ab7 100644 --- a/lib/reporters/default.js +++ b/lib/reporters/default.js @@ -83,8 +83,8 @@ function defaultReporter(emitter) { logUpdateProgress(event, "error", info.updateTo + " failed".grey); finishProgress(); }); - emitter.on("testErrors", function (event) { - console.log(event.errors); + emitter.on("testStdout", function (event) { + console.log(event.testStdout); }); emitter.on("updatingDone", function (event) { var info = event.info; diff --git a/lib/run.js b/lib/run.js index abf678f..0700ab4 100644 --- a/lib/run.js +++ b/lib/run.js @@ -76,9 +76,9 @@ function run(config, done) { return; } emitter.emit("rollbackDone", event); - if (config.testErrors) { - event.errors = testStdout; - emitter.emit("testErrors", event); + if (config.testStdout) { + event.testStdout = testStdout; + emitter.emit("testStdout", event); } done(); }); diff --git a/test/run.js b/test/run.js index 1f692d7..05da055 100644 --- a/test/run.js +++ b/test/run.js @@ -231,7 +231,6 @@ function execMock(object, testsExpectToPass) { if (cmd === "npm outdated --json --long --depth=0") { setImmediate(cb, null, JSON.stringify(object), null); } else if (cmd === "npm test" && !testsExpectToPass) { - console.log("PASS"); setImmediate(cb, new Error("test failed"), "This is the test error stdout", "This is the test error stderr"); } else { setImmediate(cb, null); @@ -523,19 +522,19 @@ describe("run()", function () { }); }); - describe.only("testErrors", function () { - describe("if --test-errors is set and update fails", function () { + describe("testStdout", function () { + describe("if --test-stdout is set and update fails", function () { before(setupOutdatedModules(outdatedModules, false)); afterEach(tearDown); it("should be emitted", function (done) { reporter = function (emitter) { - emitter.on("testErrors", function (options) { + emitter.on("testStdout", function (options) { expect(options).to.eql(expectedOptionsWithCurrentCountLatestAndTestErrors); }); }; - run({ cwd: process.cwd(), reporter: reporter, testErrors: true }, done); + run({ cwd: process.cwd(), reporter: reporter, testStdout: true }, done); }); }); });