Set `test.meta.debugMode = true` when timeout has been disabled for debugging
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
I'm using AVA to test a program that interacts with a Postgres database and has timing-related tests ([code here](https://github.com/bitauth/chaingraph/blob/10ff420143ddc18786a25f3d7cea161719653360/src/e2e/e2e.spec.ts#L446-L477)).
I'm analyzing the `stdout` from a child process to verify it's producing the expected results. Results can sometimes come in unexpected orders, so I need close control over how long to wait for each, and timers run in parallel, so `t.timeout()` isn't really a good fit.
It's easy enough to manage the timers myself, but one inconvenience is that I need to manually disable them when debugging the tests. (AVA logs `⚠ The timeout option has been disabled to help with debugging.` which is perfect, but my timers still interfere with debugging.)
Also, my tests can't inspect whether or not the inspector is active for some reason (probably something about them being in separate processes?) so I can't use the same code as AVA here:
https://github.com/avajs/ava/blob/639b9050a6860f83861ba00e27099f3bec7915bf/lib/cli.js#L122-L133
It would be very helpful if AVA somehow exposed this boolean to my tests so I can have them deliberately behave differently in debug mode. Maybe by adding it to `test.meta`? E.g.:
```ts
if(test.meta.debugMode) {
// code to run if AVA is in debugging mode
}
```
Contributor guide
Research direction
Start with the debug-mode detection referenced in lib/cli.js around lines 122-133, then trace how test.meta is assembled and exposed to tests. Confirm the expected behavior from the issue's test.meta.debugMode example; the work is done when tests can reliably read whether AVA debugging mode is active without changing normal test behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100