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

Ability to filter out the stack trace #1170

Closed
lucassus opened this issue Mar 26, 2014 · 6 comments
Closed

Ability to filter out the stack trace #1170

lucassus opened this issue Mar 26, 2014 · 6 comments

Comments

@lucassus
Copy link

Something simillar we could do in jasmine-node https://github.com/mhevery/jasmine-node/blob/dfa2e18517d8fbc5357489de643376eb5e303dfe/lib/jasmine-node/index.js#L128

It could be extremely useful for debugging failed scenarios written along with https://github.com/angular/protractor or other library. Currently stack traces contain too much details and it's hard to figure out where we should start debugging the failed scenario. For example https://gist.github.com/lucassus/de99d54cfb98c6ae60eb

@lucassus
Copy link
Author

currently I use this dirty hack (reporers/base.js):

    // filter the stack trace
    var lines = [];
    stack.split(/\n/).forEach(function(line){
      if (!line.match("/node_modules/")) {
        lines.push(line);
      }
    });
    stack = lines.join('\n');

    // indent stack trace without msg
    stack = stack.slice(index ? index + 1 : index)
      .replace(/^/gm, '  ');

@lucassus
Copy link
Author

@visionmedia do you have any thoughts about this feature request? If it's worth to have I could implement it.

@travisjeffery
Copy link
Contributor

i don't think it's necessary. you could make your own filterable reporter, no need to hack the base reporter.

@rstacruz
Copy link
Contributor

Hey guys, I've managed to implement this exactly, and published it as a new package. I found node_modules quite a nuissance too. It's simply used alongside mocha as --require mocha-clean.

https://github.com/rstacruz/mocha-clean

@hellboy81
Copy link

Is there possible to implement mocha-clean feature in mocha:

remove node-modules from stack trace?

@danielstjules
Copy link
Contributor

#1766 We originally had it enabled by default

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

No branches or pull requests

5 participants