Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JustinGrote opened this issue Apr 14, 2023 · 0 comments · May be fixed by #240

Comments

@JustinGrote
Copy link

JustinGrote commented Apr 14, 2023

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

if (debug && !config.launcherScript) {
execArgv.push(`--inspect-brk=${config.debuggerPort}`);
}

Alternative

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

@JustinGrote JustinGrote changed the title Debug Indicator? Add Debug Indicator to Test Run Invocation that differentiates between a run session and a debug session Apr 14, 2023
JustinGrote added a commit to JustinGrote/vscode-mocha-test-adapter that referenced this issue Apr 14, 2023
@JustinGrote JustinGrote linked a pull request Apr 14, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant