Skip to content

Debug Typescript + TSX not working #61

@agostta

Description

@agostta

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": ["<node_internals>/**", "${workspaceFolder}/node_modules/**"]
        }
    ]
}

Thank you is advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions