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

Added SimpleDiff #733

Closed
wants to merge 2 commits into from
Closed

Added SimpleDiff #733

wants to merge 2 commits into from

Conversation

bitmage
Copy link

@bitmage bitmage commented Jan 23, 2013

I often have instances where the diff printout obstructs the problem rather than clarifying it. For instance:

Screen shot 2013-01-22 at 5 09 13 PM

With the change I made, it now avoids the work of interspersing the actual/expected:

Screen shot 2013-01-22 at 5 09 54 PM

I suppose I don't expect this to be accepted vanilla, but maybe we could have something which detects how many characters (or characters in a row) are different. If there's a big difference (easy to see, likely completely different strings), just show them side by side with simpleDiff. If there's a small difference (hard to see, probably a similar string), then use your existing diff.

Related to this, it seems like the showDiff flag is being ignored. I'm using should.js, and upon removing the showDiff flag there, mocha still displayed the exact same output. Is that intentional?

It sure would be nice to have a config option for diff formatting!

@AdamBrodzinski
Copy link

FWIW, this would really really help me as well. I love the way it is for integration tests but some times it can really slow me down. I find myself console.log'ing to see what the entire line was... For my particular use I find that 75 chars is a nice breakpoint.

Screen Shot 2013-02-02 at 7 50 13 PM

@bitmage thanks for the pull request! At the very least i'm using it on my local copy of Mocha.

@katowulf
Copy link

Maybe just show the diff and show the actual/expected, such as qUnit does? The diffs can occasionally be baffling in any use case--objects, numbers, strings--and sometimes extremely useful; it's hard to predict in some logical way.

@tj
Copy link
Contributor

tj commented May 22, 2013

yeah tough call sometimes it's handy, configurable would be nice

@tj tj closed this in 3044602 May 22, 2013
wvl added a commit to wvl/mocha that referenced this pull request May 29, 2013
* upstream/master: (63 commits)
  mkdirp dep - latest version
  add object diff test
  style
  Release 1.10.0
  remove anon-wrapper in tail.js now that the entire thing is wrapped
  refactor
  use resolve() instead of join() for --require
  change to always use word-based diffs for now. Closes mochajs#733
  add support to pass through flags such as --debug-brk=1234. Closes
mochajs#852
  remove a comment
  Add globbing to support windows-style globs.
  Adding filterLeaks() condition to not consider indices in global
object as leaks
  fix mocha.css whitespace
  Restricting css rules to the mocha container as necessary. Should
minimize interference with external styles
  add sans-serif for arial fallback
  fix weird "em" whitespace
  Save timer references to avoid Sinon interfering in the browser build.
  prevent hooks from being called if we are bailing
  adding before hook to --bail test
  Support `--prof` for profiling
  ...

Conflicts:
	mocha.css
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants