Skip to content

Using lb-mocha with VSCode's debug feature results in an error #1348

@shimks

Description

@shimks

Description / Steps to reproduce / Feature proposal

When using VSCode's debugging feature with LoopBack 4's testing script lb-mocha, it is not possible to use the restart button as doing so would result in timing out with an ECONNREFUSED error. I believe this is because the child processes (or the parent processes) aren't being correctly shut down when restarting.

There are two child processes involved when lb-mocha is invoked:
lb-mocha -> mocha (1st child process) -> _mocha (2nd child process)

Below is the settings I've tried to use with lb-mocha in launch.json

    {
      "type": "node",
      "request": "launch",
      "name": "Run Mocha tests",
      "program": "${workspaceRoot}/node_modules/.bin/lb-mocha",
      "cwd": "${workspaceRoot}",
      "args": [
        "DIST/test/**/*.js",
        "-t",
        "0",
        "--inspect"
      ],
      "autoAttachChildProcesses": true
    }

Ideally, we'd like to directly call _mocha so that we wouldn't have to deal with child processes, but that brings up the question of how we are going to handle testing the correct build for the node version the user is on.

This was brought up in #1336

See Reporting Issues for more tips on writing good issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Internal ToolingIssues related to our tooling and monorepo infrastructorestale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions