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

🐛 Bug: Diffs no longer show line changes #1712

Open
raine opened this issue May 26, 2015 · 5 comments
Open

🐛 Bug: Diffs no longer show line changes #1712

raine opened this issue May 26, 2015 · 5 comments
Labels
status: accepting prs Mocha can use your help with this one! type: bug a defect, confirmed by a maintainer

Comments

@raine
Copy link

raine commented May 26, 2015

Update from 2.2.4 to 2.2.5 improved diff color contrast, but lost information on line changes.

Before

After

@a8m
Copy link
Contributor

a8m commented May 26, 2015

The string diff of v2.2.4 is actually a regression(see: #1241), but it doesn't change the fact that the reporter loses data.
I'll try to fix it.
Thanks @raine

update: after I tested more deeply, it's seems like it's something belong to diff and how we use it (see: cleanup).

@raine
Copy link
Author

raine commented May 26, 2015

No problem. FWIW, I'd prefer to see the strings in style similar to util.inspect as it used to be. It's important to see the difference in detail.

@jbnicolai jbnicolai added the type: bug a defect, confirmed by a maintainer label Jun 5, 2015
@danielstjules
Copy link
Contributor

This is still the case with 2.3.2:

$ cat test.js
var assert = require('assert');

it('test', function() {
  var a = '1\n2\n3\n';
  var b = '123';

  assert.equal(a, b);
});

$ ./bin/mocha test.js


  

  0 passing (6ms)
  1 failing

  1)  test:

      AssertionError: '1\n2\n3\n' == '123'
      + expected - actual

      -1
      -2
      -3
      +123

      ...

cc @mochajs/mocha Any preference here between the two screenshots in the original msg? Is the current output a problem?

@ScottFreeCode
Copy link
Contributor

I very much prefer seeing this:

-1
-2
-3

...over seeing this:

-1\n2\n3\n

The thing I'd consider problematic here is that we can't tell whether there's a trailing newline. What I think we should be seeing is this:

-1
-2
-3
-

(By extension, two \n on the end should result in two - lines, etc. Current behavior is one - for every newline except the last one, which makes one \n and no \n on the end ambiguous; we don't want to fix it only partway and make one \n and two \n ambiguous.)

@stale stale bot added the stale this has been inactive for a while... label Oct 17, 2017
@boneskull boneskull removed the stale this has been inactive for a while... label Oct 17, 2017
@boneskull
Copy link
Contributor

not stale

@boneskull boneskull added the status: accepting prs Mocha can use your help with this one! label Oct 18, 2017
@mochajs mochajs deleted a comment from stale bot Oct 18, 2017
@JoshuaKGoldberg JoshuaKGoldberg changed the title Diffs no longer show line changes 🐛 Bug: Diffs no longer show line changes Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepting prs Mocha can use your help with this one! type: bug a defect, confirmed by a maintainer
Projects
None yet
Development

No branches or pull requests

6 participants