-
-
Notifications
You must be signed in to change notification settings - Fork 305
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
Fix for not showing path for error messages on windows #316
Conversation
Third time's the charm! |
@@ -217,7 +217,7 @@ Test.prototype._assert = function assert (ok, opts) { | |||
if (!ok) { | |||
var e = new Error('exception'); | |||
var err = (e.stack || '').split('\n'); | |||
var dir = path.dirname(__dirname) + '/'; | |||
var dir = path.dirname(__dirname) + path.sep; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use path.join
here instead of directly referencing path.sep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean path.join(path.dirname(__dirname), path.sep)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see that path.join
will always omit the trailing separator. This is fine as-is.
Are there tests that ensure this isn't breaking anything, and tests that are currently failing on windows? |
As far as I can tell there were no specific tests for this feature, but this modification does not break the current tests. (On windows one test was breaking even before this, I can try to fix that if needed). If a well tested, multi-platform stack-trace parser is desired, then we should probably include stacktrace-parser as suggested in #295. I will be on vacation from tomorrow, but if you could give me some guidance which way to go about it, I will try to do what it takes next week. |
I'd like to see proper errors in all cases. So I modified tape to node index.js
browserify -d index.js | tape-run
As I see it there are 3 problems
|
@bsuh seems like a couple of those need filing upstream on browserify itself - can you file those, and link them here? |
|
Lets be realistic. This is the third PR of this subject. The first two were never merged because one the two parties (the contributor or the maintainer) stopped answering requests/questions from the other party, after the discussion got too long (and that's OK). The goal of this third attempt is to introduce the minimal change to fix the bug for most cases. The goal is not to fix for all cases (see #295 for that @bsuh). Merging this PR is safe. The new regex is guaranteed to match anything the old one matched, so regressions are not possible. The worst than can happen is users that did not see any stack trace before seeing a partial stack trace. In the meantime, Windows users finally get proper stack traces on errors. Lets get 80% of the benefits for 20% of the effort. 100% correctness can come later, one step at a time. :) |
@mkls would you mind rebasing on latest master so there's no merge commits? I'll merge this after that. |
This bug has been around for a while now. Tried to keep changes to the bare minimum.
- [Fix] `throws`: only reassign “message” when it is not already non-enumerable (#320) - [Fix] show path for error messages on windows (#316) - [Fix] `.only` should not run multiple tests with the same name (#299, #303) - [Deps] update `glob`, `inherits` - [Dev Deps] update `concat-stream`, `tap`, `tap-parser`, `falafel` - [Tests] [Dev Deps] Update to latest version of devDependencies tap (v7) and tap-parser (v2) (#318) - [Tests] ensure the max_listeners test has passing output - [Docs] improvements (#298, #317)
This bug has been around for a while now, there are two open PR's (#221 and #295) but no activity recently.
This is basically the solution proposed by @hgwood.
Tried to keep changes to the bare minimum.