lucono/karma-test-explorer

Jasmine requires pathMapping that isn't being set automatically

mattalxndr opened this issue · 2 comments

Is Your Feature Request related to a Problem? Please Describe

  • Jasmine tests require /base/* URLs be mapped to the project root. Otherwise breakpoints don't work while debugging because the runtime can't find the correct sources.

Describe the Solution You'd Like

  • Considering this extension has other auto-detection happening, this seems like a missing feature. I know I would have saved some time.

Describe Alternatives You've Considered

  • Adding this configuration:
"karmaTestExplorer.debuggerConfig": {
    "name": "Karma Test Explorer Debugging",
    "type": "pwa-chrome",
    "request": "attach",
    "browserAttachLocation": "workspace",
    "address": "localhost",
    "port": 9222,
    "timeout": 60000,
    "webRoot": "${workspaceRoot}",
    "pathMapping": {
      "/base": "${workspaceFolder}",
      "/base/test": "${workspaceFolder}/test",
    },  
  },

Additional Context

  • Add any other context or screenshots about the feature request here.

@mattalexx If you'd like to propose an approach, and submit a PR that can provide automatic, accurate path mappings that would work cleanly for any project, I'd be willing to review and release it.

But in v0.5.0, there are also now direct karmaTestExplorer. (webRoot | pathMapping | sourceMapPathOverrides) settings to more easily provide these mappings without necessarily having to also specify all the other debuggerConfig properties.

So you can replace your existing karmaTestExplorer.debuggerConfig setting with just:

"karmaTestExplorer.pathMapping": {
    "/base": "${workspaceFolder}",
    "/base/test": "${workspaceFolder}/test",
}

@mattalexx Closing this - please re-open if needed.