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

Stack trace filtering causing duplicate error messages #2126

Closed
Turbo87 opened this issue Feb 25, 2016 · 0 comments · Fixed by #2145
Closed

Stack trace filtering causing duplicate error messages #2126

Turbo87 opened this issue Feb 25, 2016 · 0 comments · Fixed by #2145

Comments

@Turbo87
Copy link
Contributor

Turbo87 commented Feb 25, 2016

describe('foo', function() {
  it('bar', function() {
    throw new Error('this is a test in ' + process.cwd() + '/foo/bar/test.js and it fails');
  });
});

will output

  1) foo bar:
     this is a test in /Users/tbn/Code/tmp/mocha-stack-bug/foo/bar/test.js and it fails
  Error: this is a test in foo/bar/test.js and it fails
      at Context.<anonymous> (test/test.js:5:11)

and as you can see the this is a test in message is duplicated in the output. In this example it is not a big deal but once you have larger error messages this becomes really problematic (see BadgeLabs/mocha-eslint#29).

I've tracked this down to stackTraceFilter() being applied before the BaseReporter.list() method runs which removes the message from the stack property. But since the stack has been beautified the messages will no longer be equal due to the process.cwd() removal.

Turbo87 added a commit to Turbo87/mocha-eslint that referenced this issue Feb 25, 2016
This is a workaround for mochajs/mocha#2126 but since
relative paths are usually much nicer to look at it also has its own advantages
Turbo87 added a commit to Turbo87/mocha-eslint that referenced this issue Feb 25, 2016
This is a workaround for mochajs/mocha#2126 but since
relative paths are usually much nicer to look at it also has its own advantages
Turbo87 added a commit to Turbo87/mocha-eslint that referenced this issue Feb 25, 2016
This is a workaround for mochajs/mocha#2126 but since
relative paths are usually much nicer to look at it also has its own advantages
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 a pull request may close this issue.

1 participant