firsttris / vscode-jest-runner

Simple way to run or debug one or more tests from context menu, codelens or command plalette
https://marketplace.visualstudio.com/items?itemName=firsttris.vscode-jest-runner
MIT License
265 stars 124 forks source link

Debug & Run are displayed in some test files but not others #267

Closed GP4cK closed 2 years ago

GP4cK commented 2 years ago

Hello, I'm working with this monorepo: https://github.com/TriPSs/nestjs-query When I open the root in VSCode,

  1. If I open packages/query-typeorm/__tests__/module.spec.ts, then I can see "Run" and "Debug" above describe and it.
  2. However if I open packages/query-typeorm/__tests__/services/typeorm-query.service.spec.ts, then I can't

How may I troubleshoot this? I tried commenting / deleting all the tests except one to see if it was a file size issue (1,997 lines) but that didn't work...

GP4cK commented 2 years ago

One workaround I found was to add this .vscode/launch.json:

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Debug Jest Tests",
      "type": "node",
      "request": "launch",
      "runtimeArgs": [
        "--inspect-brk", 
        "${workspaceRoot}/node_modules/.bin/jest", 
        "--runInBand",
        "-t",
        "set the relation to null", // replace with name of test
      ],
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen"
    }
  ]
}
firsttris commented 2 years ago

there is a codeLensSelector option

jestrunner.codeLensSelector CodeLens will be shown on files matching this pattern (default */.{test,spec}.{js,jsx,ts,tsx})

probably have something todo with this

GP4cK commented 2 years ago

Actually it seems it's working now on v0.4.56. Thanks for the help though.