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

URL_REGEXP in lib/reporter.js does not match karma-browserify output #1495

Closed
brianmhunt opened this issue Jul 15, 2015 · 3 comments · May be fixed by Omrisnyk/npm-lockfiles#122 or Omrisnyk/npm-lockfiles#132

Comments

@brianmhunt
Copy link
Contributor

Related to #1097, the URL_REGEXP in karma/lib/reporter.js fails for karma-browserify. Karma-browserify spits out urls like this:

absolute/var/folders/vl/_5jh_5_n3njb7rfcg5tr87p80000gn/T/2316ae91e848b763869f68a80a8e5489.browserify?745c3db05ccd6d7437dca35f2a7b84cdfb23abf1:17133:22

Whereas the expression,

var URL_REGEXP = new RegExp('http:\\/\\/[^\\/]*\\/' +
    '(base|absolute)' + // prefix
    '((?:[A-z]\\:)?[^\\?\\s\\:]*)' + // path
    '(\\?\\w*)?' + // sha
    '(\\:(\\d+))?' + // line
    '(\\:(\\d+))?' + // column
    '', 'g')

clearly does not match the output. A simple fix that I have tested is to remove the protocol, like this:

var URL_REGEXP = new RegExp('\\/' +
    '(base|absolute)' + // prefix
    '((?:[A-z]\\:)?[^\\?\\s\\:]*)' + // path
    '(\\?\\w*)?' + // sha
    '(\\:(\\d+))?' + // line
    '(\\:(\\d+))?' + // column
    '', 'g')

I will cross-post an issue with karma-browserify, as the fix may be preferable on their end.

@brianmhunt
Copy link
Contributor Author

Here's a minimum working example:

https://gist.github.com/brianmhunt/e9b54d35af5c6537e3c8

@dignifiedquire
Copy link
Member

Thanks @brianmhunt for the investigation, I'm happy with your suggested fix. Are you up for a PR?

@brianmhunt
Copy link
Contributor Author

Awesome, thanks @dignifiedquire

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants