Alexandru DuDu
Alexandru DuDu

Reputation: 1044

Debugger starts on node-tap instead of starting on test file

I am trying to debug a test file in docker that runs with node-tap. I have added the running command, configured the debugger to connect to docker. Everything works, the tests are run and the debugger connects, but it debugs the node-tap module instead of the test file.

I have the following command:

"dev:test": "NODE_ENV=test tap --debug --node-arg=--loader=ts-node/esm --node-arg=--no-warnings --node-arg=--experimental-specifier-resolution=node --node-arg=--inspect-brk=0.0.0.0:3034 tests/e2e/component.test.ts --timeout=1200 --jobs=1"

And here is the launch.json

{
"version": "0.2.0",
"configurations": [
  {
    "name": "Attach to Docker",
    "type": "node",
    "request": "attach",
    "port": 3034,
    "address": "0.0.0.0",
    "localRoot": "${workspaceFolder}",
    "remoteRoot": "/app",
    "restart": true,
    "outFiles": ["${workspaceFolder}/build/**/*.js"],
    "skipFiles": ["<node_internals>/**/*.js", "${workspaceFolder}/node_modules/**/*.js"]
  }
]

}

When I run yarn dev:test, the debugger connects but I get sent to this: enter image description here

Also when I add a breakpoint in my test file, it says: some of the brakpoints could not be set.

I found that adding the property program to the launch.json pointing to the file I want to run would solve the problem, but it says that the property is not allowed.

I also tried to point to different locations in localRoot and remoteRoot but it doesn't work also.

What can it be?

Upvotes: 0

Views: 157

Answers (1)

Alexandru DuDu
Alexandru DuDu

Reputation: 1044

Found the problem.

Seems like the outFiles in launch.json was causing the problem. After removing it and letting it to take the default value it worked. (As I understand this is for yarn).

It still starts the debugging in tap module, but if I press f5 (the continue) it is stopping at the next breakpoint I set.

Upvotes: 0

Related Questions