Currently, I am in the process of configuring a launch setup in Visual Studio Code for debugging my unit tests.
The unit tests are written in Typescript, and both the tests and the corresponding code are compiled into a single js file with a source map.
After setting up the configuration as shown below, I can successfully set breakpoints in the js file. Visual Studio Code highlights the line in the ts file when it hits a breakpoint in the js file, indicating that the sourcemap is partially functional. However, attempts to place breakpoints directly in a ts file are not recognized.
Does anyone have suggestions on how I can resolve this issue and make breakpoints in the ts file work?
{
"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"
}
]
}