Skip to content

Commit

Permalink
Fix: remove dupe error message in bin/eslint (fixes eslint#8964)
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorHom committed Sep 17, 2017
1 parent 439e8e6 commit 8a8152c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion bin/eslint.js
Expand Up @@ -49,7 +49,6 @@ process.once("uncaughtException", err => {
console.error(`\nESLint: ${pkg.version}.\n${template(err.messageData || {})}`);
} else {

console.error(err.message);
console.error(err.stack);
}

Expand Down
5 changes: 4 additions & 1 deletion tests/bin/eslint.js
Expand Up @@ -263,14 +263,17 @@ describe("bin/eslint.js", () => {
});

describe("handling crashes", () => {
it("prints the error message to stderr in the event of a crash", () => {
it("prints the error message exactly once to stderr in the event of a crash", () => {
const child = runESLint(["--rule=no-restricted-syntax:[error, 'Invalid Selector [[[']", "Makefile.js"]);
const exitCodeAssertion = assertExitCode(child, 1);
const outputAssertion = getOutput(child).then(output => {
const expectedSubstring = "Syntax error in selector";

assert.strictEqual(output.stdout, "");
assert.include(output.stderr, expectedSubstring);

// The message should appear exactly once in stderr
assert.strictEqual(output.stderr.indexOf(expectedSubstring), output.stderr.lastIndexOf(expectedSubstring));
});

return Promise.all([exitCodeAssertion, outputAssertion]);
Expand Down

0 comments on commit 8a8152c

Please sign in to comment.