hbenl / vscode-mocha-test-adapter

Mocha Test Adapter for the VS Code Test Explorer
MIT License
91 stars 31 forks source link

Add Debug Indicator to Test Run Invocation that differentiates between a run session and a debug session #239

Open JustinGrote opened 1 year ago

JustinGrote commented 1 year ago

Is there anything that indicates whether I am in run test or debug test?

I'm running tests against a vscode extension and while I can set my test vscode to inspect, usually the debugger doesn't attach until after the test has run. I could introduce a delay but I'd much rather have some kind of indicator either by environment variable or by arg passed to my launcher script that we are in debug mode vs. run mode so I can instruct my vscode extension instance to --inspect-brk instead of just --inspect. Thanks!

EDIT: Looks like this is the intended behavior, but it only works if launcherscript is not specified. I think an env var would be appropriate to pass to the run process if debug is true, like __TEST_MOCHA_ADAPTER_DEBUG=true https://github.com/hbenl/vscode-mocha-test-adapter/blob/f519292b7b0039a9f27ec544157953a9d9e3aa42/src/core.ts#L279-L281

Alternative

Start the debugging config before launching the process, so it hopefully attaches quickly, may need to increase default attach timeout.