使用Visual Studio Code在Typescript Jasmine测试中设置断点

Dan*_*Dan 9 typescript visual-studio-code

我试图在Visual Studio代码中设置启动配置,以便我可以调试我的单元测试.

我的测试是用Typescript编写的.测试和他们测试的代码被编译成带有源映射的单个js文件.

通过下面的配置,我可以在js文件中设置断点,并使Visual Studio代码在停止时突出显示ts文件中的行.这表明源图在某种程度上起作用.但是,如果我在ts文件中放置一个断点,那么它将被忽略.

关于如何在ts文件中获取断点的任何想法都有效?

{
    "version": "0.1.0",
    // List of configurations. Add new configurations or edit existing ones.
    // ONLY "node" and "mono" are supported, change "type" to switch.
    "configurations": [
        {
            // Name of configuration; appears in the launch configuration drop down menu.
            "name": "Unit tests",
            // Type of configuration. Possible values: "node", "mono".
            "type": "node",
            // Workspace relative or absolute path to the program.
            "program": "node_modules/jasmine/bin/jasmine.js",
            // Automatically stop program after launch.
            "stopOnEntry": false,
            // Command line arguments passed to the program.
            "args": ["JASMINE_CONFIG_PATH=test/script/jasmine.json"],
            // Workspace relative or absolute path to the working directory of the program being debugged. Default is the current workspace.
            "cwd": ".",
            // Workspace relative or absolute path to the runtime executable to be used. Default is the runtime executable on the PATH.
            "runtimeExecutable": null,
            // Optional arguments passed to the runtime executable.
            "runtimeArgs": ["--nolazy"],
            // Environment variables passed to the program.
            "env": { },
            // Use JavaScript source maps (if they exist).
            "sourceMaps": true,
            // If JavaScript source maps are enabled, the generated code is expected in this directory.
            "outDir": "test/script"
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

Dan*_*Dan 1

我已将 VS Code 更新至 0.10.9,将 Typescript 更新至 1.8.2,现在“正常工作”。