Skip to content

Instantly share code, notes, and snippets.

@Jack-Works
Last active April 30, 2023 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jack-Works/80d69633a55af03cec1f1d6328ffa9d1 to your computer and use it in GitHub Desktop.
Save Jack-Works/80d69633a55af03cec1f1d6328ffa9d1 to your computer and use it in GitHub Desktop.
Debug TypeScript
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Mocha Tests (currently opened test)",
"runtimeArgs": ["--nolazy"],
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
"args": [
"-u",
"bdd",
"--no-timeouts",
"--colors",
"built/local/run.js",
"-f",
// You can change this to be the name of a specific test file (without the file extension)
// to consistently launch the same test
"${fileBasenameNoExtension}",
"--skip-percent",
"0"
],
"env": {
"NODE_ENV": "testing"
},
"outFiles": [
"${workspaceFolder}/built/**/*.js",
"${workspaceFolder}/built/**/*.mjs",
"${workspaceFolder}/built/**/*.cjs",
"!**/node_modules/**"
],
"preLaunchTask": "npm: build:tests",
"console": "integratedTerminal",
"customDescriptionGenerator": "'__tsDebuggerDisplay' in this ? this.__tsDebuggerDisplay(defaultValue) : defaultValue"
},
{
// See: https://github.com/microsoft/TypeScript/wiki/Debugging-Language-Service-in-VS-Code
"type": "node",
"request": "attach",
"name": "Attach to VS Code TS Server via Port",
"processId": "${command:PickProcess}",
"customDescriptionGenerator": "'__tsDebuggerDisplay' in this ? this.__tsDebuggerDisplay(defaultValue) : defaultValue",
"outFiles": ["${workspaceFolder}/built/local/*.js", "!**/node_modules/**"],
"port": 5667
},
{
"type": "node",
"name": "Launch VSCode",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--user-data-dir=${workspaceFolder}/.vscode/.vscode-debug", "${workspaceFolder}/../vscode-debug"],
"env": {
"TSS_DEBUG": "5667",
"NODE_ENV": "development"
}
}
]
}
{
// Use the TypeScript debug build. Change to your repo if it is not the case.
"typescript.tsdk": "../TypeScript/built/local",
// The following two options are intended to disable the extra process started so we can attach to the target faster (only 1 result after filter with "local")
"typescript.tsserver.useSyntaxServer": "never",
"typescript.disableAutomaticTypeAcquisition": true,
"window.zoomLevel": 1,
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"workbench.colorTheme": "Quiet Light"
}
{
"scripts": {
"start": "node ../TypeScript/built/local/tsc.js -w -p .",
"build": "node ../TypeScript/built/local/tsc.js -p ."
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment