Skip to content

Sourcemap regex, not working in windows #1200

@chandru9279

Description

@chandru9279

I'm using karma-bro.

Im getting callstacks

ReferenceError: Can't find variable: CustomVar at http://localhost:9000/absoluteC:/Users/Zasz/AppData/Local/Temp/a08f24cea0a6c2e347f78175362d890cf06e8561.browserify?da39a3ee5e6b4b0d3255bfef95601890afd80709:247"

I can see that you are using the regex to rewrite callstacks:

 /http:\/\/[^\/]*\/(base|absolute)([^\?\s\:]*)(\?\w*)?(\:(\d+))?(\:(\d+))?/g

The regex fails - the path, line and column not detected properly on my machine - so I don't get sourcemap replacement in my callstack.

Here is a test case, you can run this in browser for quick check :

var b =  function(_, prefix, path, __, ___, line, ____, column) {
 console.log("Prefix " + prefix)
 console.log("Path " + path)
 console.log("Line " + line)
 console.log("Col " + column)
 };

 var a = "ReferenceError: Can't find variable: Customvar at http://localhost:9000/absoluteC:/Users/Zasz/AppData/Local/Temp/a08f24cea0a6c2e347f78175362d890cf06e8561.browserify?da39a3ee5e6b4b0d3255bfef95601890afd80709:247";


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

a.replace(URL_REGEXP, b);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions