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

🚀 Feature: Indent all lines on message #2159

Closed
piranna opened this issue Mar 17, 2016 · 9 comments
Closed

🚀 Feature: Indent all lines on message #2159

piranna opened this issue Mar 17, 2016 · 9 comments
Labels
area: reporters involving a specific reporter status: wontfix typically a feature which won't be added, or a "bug" which is actually intended behavior type: feature enhancement proposal

Comments

@piranna
Copy link

piranna commented Mar 17, 2016

As discussed at BadgeLabs/mocha-eslint#38 (comment) mocha only indent the first line of the report message, making it ugly since it gets unaligned with the mocha output. I've also seen that the code to indent the message is duplicated in several of the reporters, so if you like the idea I could try to unify them and implement it myself.

/cc @Turbo87

@danielstjules
Copy link
Contributor

Can you give an example where formatting is broken? E.g. this seems correct to me:

describe('suite', function() {
  it('test', function() {});
  it('test2', function() {
    throw new Error('foo');
  });
});

$ mocha example.js


  suite
    ✓ test
    1) test2


  1 passing (10ms)
  1 failing

  1) suite test2:
     Error: foo
      at Context.<anonymous> (example.js:4:11)

@Turbo87
Copy link
Contributor

Turbo87 commented Mar 21, 2016

@danielstjules the issue is visible if you have a multi-line error message:

describe('suite', function() {
  it('test', function() {});
  it('test2', function() {
    throw new Error('foo\nbar\nbaz');
  });
});
$ mocha example.js


  suite
    ✓ test
    1) test2


  1 passing (11ms)
  1 failing

  1) suite test2:
     Error: foo
bar
baz
      at Context.<anonymous> (example.js:4:11)

@piranna
Copy link
Author

piranna commented Mar 21, 2016

Yes, the problem is the one that @Turbo87 has described, if the error message has multiple lines they get unindented. It would be as simple as split the message on new lines and apply the indention to all of them.

@drazisil drazisil added type: bug a defect, confirmed by a maintainer confirmed labels Mar 30, 2017
@2kindsofcs
Copy link

2kindsofcs commented Aug 15, 2019

Hi there. I checked out exactly the same issue is still present(ver 6.2.0). I would like to fix this problem.

@JoshuaKGoldberg
Copy link
Member

This feels to me like something that should be behind an option. It's useful to be able to select & copy the exact characters of an error in some cases.

@JoshuaKGoldberg JoshuaKGoldberg changed the title Indent all lines on message 🚀 Feature: Indent all lines on message Dec 27, 2023
@JoshuaKGoldberg JoshuaKGoldberg added type: feature enhancement proposal and removed type: bug a defect, confirmed by a maintainer labels Dec 27, 2023
@JoshuaKGoldberg
Copy link
Member

Coming back to this: per #5027 we're trying not to make too many big changes, and there are already a lot of options in Mocha. This issue has received, on average, about one positive interaction every 1.5 years since it was filed. I don't think it makes the cut.

If you really want this to happen, please do ask to re-open. We certainly can. But please also provide a concrete proposal for what the option would look like. 🙂

@JoshuaKGoldberg JoshuaKGoldberg closed this as not planned Won't fix, can't repro, duplicate, stale Jan 21, 2024
@JoshuaKGoldberg JoshuaKGoldberg added the status: wontfix typically a feature which won't be added, or a "bug" which is actually intended behavior label Jan 21, 2024
@piranna
Copy link
Author

piranna commented Jan 21, 2024

please also provide a concrete proposal for what the option would look like. 🙂

I think @Turbo87 already showed the actual issue...

@JoshuaKGoldberg
Copy link
Member

I mean, the option. Like, what CLI option would be added to Mocha.

@piranna
Copy link
Author

piranna commented Jan 21, 2024

I don't think it needs an option, or if any, it should be enabled by default and an opt-out option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: reporters involving a specific reporter status: wontfix typically a feature which won't be added, or a "bug" which is actually intended behavior type: feature enhancement proposal
Projects
None yet
Development

No branches or pull requests

7 participants