connor4312 / connor4312/nodejs-testing

Debug Typescript + TSX not working

Open
#61 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
67
Forks
15
PR merge metrics
No merged PRs in 30d

Description

I am facing some difficult to Debug my tests.
I am not an expert in Node, so I am giving my bests here after many hours.

It's running fine the tests in TS,
but the DEBUG breakpoint **do not break** when executed using the extension: Right click > Debug Test

settings.json
(I believe the problem is here)
```
"nodejs-testing.extensions": [
{
"extensions": ["mjs", "cjs", "js"],
"parameters": []
},
{
"extensions": ["mts", "cts", "ts"],
"parameters": ["--import", "tsx"]
}
]
```

tsconfig.json
```
{
"compilerOptions": {
"module": "NodeNext",
"moduleResolution": "NodeNext",
"target": "ESNext",
"sourceMap": true,
"allowSyntheticDefaultImports": true,
"noImplicitAny": false,
"moduleDetection": "force",
"resolveJsonModule": true,
"allowJs": true,
"esModuleInterop": true,
"isolatedModules": true,

"outDir": "dist",
"rootDir": "src",
"baseUrl": "."
},
"include": ["src"],
"exclude": ["node_modules"]
}
```

Luckily I can debug with the launch.json. But it's runs the entire file, and I want Debug **only one test**.
```
{
"version": "0.2.0",
"configurations": [
{
"name": "tsx file",
"type": "node",
"request": "launch",
"preLaunchTask": "tsc: build - tsconfig.json",
"program": "${file}",
"runtimeExecutable": "tsx",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"skipFiles": ["/**", "${workspaceFolder}/node_modules/**"]
}
]
}
```

Thank you is advance.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.