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

pathMapping key must end in / #393

mlewand opened this Issue Apr 1, 2017 · 2 comments


None yet
2 participants
Copy link

mlewand commented Apr 1, 2017

I'm trying to attach debugger to chrome to a webserver that serves files with some prepended part to the URL, so that file:

<workspaceRoot>/test/bar.js (filesystem) becomes http://host/base/bar.js?randomtoken (webhost addr) so you can see that I'm trying to replace /base with /test.

According to docs I should do this with pathMapping config property.

I tried numerous configruations:

"pathMapping": {
	"/": "${workspaceRoot}",
	"/base": "${workspaceRoot}/test"

At some point I thought that asterix might be inlined somewhere? As it was reoccuring somewhere.

"pathMapping": {
	"/": "${workspaceRoot}",
	"/base*": "${workspaceRoot}/test*"

However it does not match /base prefix at all.

Full config available at karma-and-vscode-debugging's launch.json file.

Full steps to reproduce:

  1. Clone repo.
  2. Install deps.
  3. Run npm test (runs a server).
  4. Open project with VSCode code ..
  5. Attach the debugger with f5.
  6. Hit refresh to make karma re-run tests with ctrl/cmd+r.
  7. Evaluate .scripts in your debugger console to see paths.


Among dumped files, example.js being correctly mapped to test directory, like so:

› http://localhost:8080/base/example.js?51a5f49ea9a60b2b374e551ba2e49c94c476d5b7 (c:\foo\bar\karma-and-vscode-debugging\test\example.js)


"base" not being replaced with "test".

› http://localhost:8080/base/example.js?51a5f49ea9a60b2b374e551ba2e49c94c476d5b7 (c:\foo\bar\karma-and-vscode-debugging\base\example.js)

I'm also inlcuding a log here:


This comment has been minimized.

Copy link

roblourens commented Apr 1, 2017

Thanks for the test repo and log. You're gonna hate me for this one! It only works if the pathMapping key ends in a slash. I can debug example.js with

"pathMapping": {
	"/": "${workspaceRoot}",
	"/base/": "${workspaceRoot}/test/"

No good reason for that. I'll fix it.

@roblourens roblourens added the bug label Apr 1, 2017

@roblourens roblourens changed the title pathMapping doesnt seem to replace beginning of URL pathMapping key must end in / Apr 1, 2017


This comment has been minimized.

Copy link
Contributor Author

mlewand commented Apr 1, 2017

@roblourens I can confirm that it works when given tailing slash.

Not a good enough reason to hate you after providing such an useful plugin, so still lot of ❤! Thanks for quick turnaround.

BTW I tried to troubleshot it on my own and make a PR with fix, but I figured out I'm not proficient with TS.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.