Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: remove dupe error message in bin/eslint (fixes #8964) #9320

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion bin/eslint.js
Original file line number Diff line number Diff line change
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
7 changes: 5 additions & 2 deletions tests/bin/eslint.js
Original file line number Diff line number Diff line change
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 All @@ -281,7 +284,7 @@ describe("bin/eslint.js", () => {
const child = runESLint(["--no-ignore", invalidConfig]);
const exitCodeAssertion = assertExitCode(child, 1);
const outputAssertion = getOutput(child).then(output => {
const expectedSubstring = "Error: bad indentation of a mapping entry at line";
const expectedSubstring = "bad indentation of a mapping entry at line";

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