Skip to content

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

@brianmhunt

Description

@brianmhunt

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions