-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Failing tests no longer produce stack traces with clickable file links #3383
Comments
Since you jumped several major versions at once, did you try updating one major version at a time, then one minor version, then one patch version? If you can tell us exactly which release it actually stopped working, it would be more helpful trying to determine why it did. Would appear from your screenshots that at some point, only the basename was printed rather than the full path. BTW, nice job on the issue report! Your first two screenshots demonstrate your problem very well. |
There was a recent change to the stacktrace-fiddling code which is a likely culprit. |
This looks like the relevant piece of code: https://github.com/mochajs/mocha/blob/master/lib/utils.js#L643-L646 |
@boneskull, see PR #2503 (from Mocha-3.1.0) [stacktracelimit munging] |
To be honest I would prefer if we could keep the path part of the stack trace small to simplify the human readability. I wonder if we can come up with a format that matches some of the regexes of different editors to add links to track traces. Here's the change in vs code that adds the ability to pick up col and line numbers: microsoft/vscode#24832 Or if the relevant scope of editors is not too large we could try to convince them of this use case :) |
think this should be changed to 'confirmed bug' |
It's |
Have either one of you attempted a replication? It would move this confirmation along. I can provide a github repo with the issue if it helps. |
I use vi on macOS. If it needs Windows to reproduce, I cannot help much past research. |
Yeah I don't use mac so unsure if it's OS specifc. Though it would be worth seeing if this does also happen on macOS no? Could also just be vscode that does it. |
It seems a design decision rather than a bug. In my OSX, stack trace path is relative path.
You can print full stack trace with
Can this solve your problem? |
Yes that fixes the issue with clickable file links, but at the expense of having a full trace. I tried using mocha-clean to compensate but that just puts you back to square one. If it's a design decision this seems odd to me as it just leaves mocha with a usability problem. Is there no way to just have the best of both worlds; a clean minimal stack trace yet clickable file references at the same time? Unsure if your editor of choice allows for this, but are your osx file links clickable at all? |
There are no links in Mocha's stacktrace output. |
Oops I forgot about this, and the email notification for this thread from that last comment popped into my head the fact that this fixed itself back at the end of June with vscode's update. Feel free to close this issue now. |
Prerequisites
faq
labelnode node_modules/.bin/mocha --version
(Local) andmocha --version
(Global). We recommend avoiding the use of globally installed Mocha.Description
Consider the following test file. It is written in common js and uses no transpilers. With an earlier version of mocha that I used (2.2.5), failing tests produced a stack trace that had clickable links (at least for vscode) to the offending file when a unit test failed. After trying mocha 5.1.1 with this same example test file it no longer works:
Steps to Reproduce
Expected behavior: Mocha should be able to produce stack traces with clickable links inside a shell/terminal (using vscode with bash) to the line and file of a failing test
Actual behavior: The stack trace file ref is no longer clickable:
Reproduces how often: Always
Versions
mocha --version
andnode node_modules/.bin/mocha --version
: 5.1.1node --version
: 10.1.0Additional Information
This issue has also been replicated in my own current project that uses babel. In babel's case the link looks different; it seems to log it twice?
To get around the problem, I've resorted to using mocha-webpack, as that does provide clickable file links.
The text was updated successfully, but these errors were encountered: