diff --git a/bin/eslint.js b/bin/eslint.js index 1a298047aed3..790f7dbeb4fa 100755 --- a/bin/eslint.js +++ b/bin/eslint.js @@ -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); } diff --git a/tests/bin/eslint.js b/tests/bin/eslint.js index 39be27fb0327..5a2142073296 100644 --- a/tests/bin/eslint.js +++ b/tests/bin/eslint.js @@ -263,7 +263,7 @@ 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 => { @@ -271,6 +271,9 @@ describe("bin/eslint.js", () => { 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]);