【发布时间】:2015-12-20 02:14:52
【问题描述】:
我正在尝试在 Visual Studio Code 中设置启动配置,以便调试我的单元测试。
我的测试是用 Typescript 编写的。测试和他们测试的代码被编译成一个带有源映射的单个 js 文件。
通过下面的配置,我可以在 js 文件中设置断点,并让 Visual Studio Code 在 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"
}
]
}
【问题讨论】:
标签: typescript visual-studio-code