'Unbound breakpoint while debugging Karma tests in VS Code

I'm trying to debug Karma tests using VS Code. I managed to run tests and attach VS Code to the headless Chrome. The problem is that breakpoints don't work after attaching VS Code. But the "debugger" keyword works well and after stopping on it, I can set new breakpoints, and it works, but old breakpoints remain unbound.

enter image description here

Here are my configs:

launch.json

"version": "0.2.0",
"configurations": [
    {
        "type": "chrome",
        "request": "attach",
        "name": "Debug Karma",
        "address": "localhost",
        "port": 9333,
        "preLaunchTask": "Start Karma",
        "trace": true,
        "pathMapping": {
            "/": "${workspaceRoot}/",
            "/base/": "${workspaceRoot}/"
        }
    }
]

tasks.json

"version": "2.0.0",
"tasks": [
    {
        "label": "Start Karma",
        "type": "npm",
        "isBackground": true,
        "script": "test-by-karma-dev",
        "problemMatcher": [
            {
                "pattern": [
                    {
                        "regexp": ".",
                        "file": 1,
                        "location": 2,
                        "message": 3
                    }
                ],
                "background": {
                    "activeOnStart": true,
                    "beginsPattern": "karma start",
                    "endsPattern": "Connected on socket"
                }
            }
        ]
    }
]


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source