scottaj / mocha.el

Emacs mode for running mocha tests

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix error regexp to support Windows filenames

felipeochoa opened this issue · comments

The regex taken from Ben Hollis' blog[1] is missing the windows path separator (backslash) from the set of allowed filename characters, so stack traces where the error is in a subdirectory don't link properly. Adding the backslash character to node-error-regexp fixes this issue:

--- a/mocha.el
+++ b/mocha.el
@@ -57,7 +57,7 @@
 (defvar mocha-project-test-directory nil)

 (defvar node-error-regexp
-  "^[  ]+at \\(?:[^\(\n]+ \(\\)?\\([a-zA-Z\.0-9_/-]+\\):\\([0-9]+\\):\\([0-9]+\\)\)?$"
+  "^[  ]+at \\(?:[^\(\n]+ \(\\)?\\([a-zA-Z\.0-9_/-\\]+\\):\\([0-9]+\\):\\([0-9]+\\)\)?$"
   "Regular expression to match NodeJS errors.
 From http://benhollis.net/blog/2015/12/20/nodejs-stack-traces-in-emacs-compilation-mode/")

no match

matches

[1]: I've also emailed Ben about this

This looks good to me, can you put your patch into a PR?