Skip to content

Commit

Permalink
Merge pull request eslint#1802 from eslint/issue1795
Browse files Browse the repository at this point in the history
Fix: Exit code should be 1 for any number of errors (fixes eslint#1795)
  • Loading branch information
nzakas committed Feb 8, 2015
2 parents fe7eb14 + 4a47cc3 commit a9ba922
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ var cli = {
}

if (printResults(engine, result.results, currentOptions.format, currentOptions.outputFile)) {
return result.errorCount;
return result.errorCount ? 1 : 0;
} else {
return 1;
}
Expand Down
16 changes: 8 additions & 8 deletions tests/lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe("cli", function() {
describe("execute()", function() {
it("should return error when text with incorrect quotes is passed as argument", function() {
var result = cli.execute("-c " + path.join(__dirname, "..", "..", ".eslintrc"), "var foo = 'bar';");
assert.equal(result, 4);
assert.equal(result, 1);
});

it("should return no error when --ext .js2 is specified", function() {
Expand Down Expand Up @@ -78,7 +78,7 @@ describe("cli", function() {

exitStatus = cli.execute(code);

assert.equal(exitStatus, 2);
assert.equal(exitStatus, 1);
});
});

Expand Down Expand Up @@ -152,7 +152,7 @@ describe("cli", function() {
it("should exit with error", function() {
var exit = cli.execute("--no-ignore tests/fixtures/undef.js");

assert.equal(exit, 3);
assert.equal(exit, 1);
});
});

Expand Down Expand Up @@ -236,7 +236,7 @@ describe("cli", function() {

assert.throws(function() {
var exit = cli.execute(code);
assert.equal(exit, 2);
assert.equal(exit, 1);
}, /Error while loading rule 'custom-rule': Cannot read property/);
});

Expand All @@ -259,7 +259,7 @@ describe("cli", function() {
assert.isTrue(call.args[0].indexOf("Literal!") > -1);
assert.isTrue(call.args[0].indexOf("2 problems") > -1);
assert.isTrue(console.log.neverCalledWith(""));
assert.equal(exit, 2);
assert.equal(exit, 1);
});


Expand Down Expand Up @@ -296,7 +296,7 @@ describe("cli", function() {
var exit = cli.execute("--no-ignore ./tests/fixtures/eslintrc/quotes.js");

assert.isTrue(console.log.calledOnce);
assert.equal(exit, 2);
assert.equal(exit, 1);
});
});

Expand All @@ -317,7 +317,7 @@ describe("cli", function() {
var exit = cli.execute("--global baz,bat --no-ignore ./tests/fixtures/undef.js");

assert.isTrue(console.log.calledOnce);
assert.equal(exit, 2);
assert.equal(exit, 1);
});

it("should allow defining writable global variables", function () {
Expand All @@ -343,7 +343,7 @@ describe("cli", function() {

exitStatus = cli.execute(code);

assert.equal(exitStatus, 2);
assert.equal(exitStatus, 1);
});
});

Expand Down

0 comments on commit a9ba922

Please sign in to comment.