Skip to content

Debug TypeScript test files - no breakpoints hit (win 10, ts 2.4.2, node 8.2.1, vs code latest) #35

@jstott

Description

@jstott

First off - awesome generator, thanks for all of your efforts.
Everything works perfectly, except the ability to debug the test file(s).

Here is what I saw when I launch test 'Debug test' with the greeter-spec.ts file open in the editor:

Cannot launch program 'd:\VSTS-DevOps\genSample\node_modules\.bin\jest'; setting the 'outDir' or 'outFiles' attribute might help.

So after several iterations & looking around at similar issues, this is the launch.json section that's working for me:

 {
      "type": "node",
      "request": "launch",
      "name": "Debug test-v4 works-single-selected file",
      "runtimeArgs": [
        "--inspect-brk",
        "${workspaceRoot}/node_modules/jest/bin/jest.js",
        "--findRelatedTests",
        "${relativeFile}",
        "--env",
        "jest-environment-node-debug",
        "--runInBand"
      ],
      "console": "integratedTerminal"
    }

I tried various combinations of program = .../.bin/jest.cmd, .../jest/bin/jest.js yada yada- but did not hit on anything until the runtimeArgs vs program & args options setup.

Interested in your take, or if anyone else ran into something similar...

working env: Windows 10, TS 2.4.2, node 8.2.1, vs code latest.

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