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

Error stack filtering should be configurable #1859

Closed
ArtemGovorov opened this issue Sep 3, 2015 · 6 comments
Closed

Error stack filtering should be configurable #1859

ArtemGovorov opened this issue Sep 3, 2015 · 6 comments
Labels
type: feature enhancement proposal

Comments

@ArtemGovorov
Copy link
Contributor

While I think excluding lines with node_modules substring from error stacks is reasonable, excluding stack lines with components substring seems very questionable. We have hit the issue in wallaby.js and I'm sure many people may have missing stack lines for their components folders and subfolders in their specs and source folders.

Setting fullTrace somewhat helps, but it starts reporting node_modules stack lines.

What do you think about having a setting to set an array of strings (or a function) to be used for filtering error stacks?

@aaronjensen
Copy link

If any are interested, here's a monkey patch work around, tested on mocha 2.3.0:

      var fail = Mocha.Runner.prototype.fail;
      var originalFilter = Mocha.utils.stackTraceFilter();

      function stackFilter(stack) {
        return originalFilter(stack.replace("/components/", "/__componentz__/"))
          .replace("/__componentz__/", "/components/");
      }

      Mocha.Runner.prototype.fail = function(test, err) {
        if (err.stack) {
          err.stack = stackFilter(err.stack);
        }

        return fail.apply(this, [test, err]);
      }
      mocha.fullTrace();

@danielstjules
Copy link
Contributor

I think just changing components to bower_components would be an immediate fix. I agree that components is too general of a term for a filter criteria. Beyond that, a regexp option for filtering the stacktrace would work well too.

@aaronjensen
Copy link

👍

@danielstjules
Copy link
Contributor

Proposed solution in #1880

@donaldpipowitch
Copy link

Any way to do custom filtering in v3?

@drazisil drazisil added the type: feature enhancement proposal label Mar 30, 2017
@drazisil
Copy link

Merged PR #1880

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature enhancement proposal
Projects
None yet
Development

No branches or pull requests

5 participants