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
File and line number incorrect when custom Matcher reports failure #254
Comments
You can add additional filtering with the sbt> test-only *ResultTest* -- traceFilter /coop.plausible.* I don't have time to verify this solution right now, but this is expected to work. |
Yes, that's how I was originally expecting it would work, but no such luck. So that's how I ended up digging a bit further to try to figure out why the traceFilter argument wasn't taking effect and discovering that line I mentioned earlier in ResultStackTrace where it filters using DefaultStackTraceFilter rather than picking up what the user included in the command-line arguments. To demonstrate, things work correctly with the following hacked up patch:
Output:
In the interests of coming up with an actual patch, I tried digging further to see if there was a way to use args.traceFilter from that context (instead of the hardcoded DefaultStackTraceFilter), but I kind of got lost in the system and was hoping you'd have a recommendation. (Or let me know if I'm still barking up the wrong tree here.) |
Chris I have a fix for you but can't commit right now. Will do in 4 hours max. |
I forgot to add |
Thanks for the fast turnaround, Eric! I verified that tracefilter now works with your fix in place. |
We have a few custom Matcher implementations, but unlike the built-in matchers such as beTrue, ours reports a not-terribly-useful file and line number. I haven't dug too deeply into specs2 to confirm this, but I suspect it might be related to the default stack trace filtering that doesn't take our package name into account:
https://github.com/etorreborre/specs2/blob/master/common/src/main/scala/org/specs2/execute/ResultStackTrace.scala#L13
Perhaps if there was a way for us to include our custom specs2 package name in the set of exclude filters, then it would solve the problem?
The following test code demonstrates the issue:
The text was updated successfully, but these errors were encountered: