Add an optional debug mode to get verbose logging
- Dominant language
- JavaScript
- Stars
- 19.8k
- Forks
- 2k
- PR merge metrics
- No merged PRs in 30d
Description
This is just an idea I've had that might help us resolve issues quicker. I'm thinking something along the lines of [debug](https://github.com/visionmedia/debug), though we can roll our own pretty easily I think if we want to.
Essentially I think it would be great if we could inject a few `console.log` calls in key parts of the code path, so when we (or anyone else) are trying to isolate an issue it's easy to see what might be going on. This would be good for checking state in internal code paths when reproducing an issue, and would let us ask users to share the output for hard-to-reproduce issues.
I'm just opening this issue for a discussion on the idea, I'm not entirely sure it's either practical or useful just yet, but I'm inclined to think it's both.
A few ways we can possibly do it (_edit_: these ideas aren't necessarily good at all, just examples in the same ballpark):
- If possible, parse any CLI flags (though I don't think we can do that since we're not a CLI app)
- Expose an option to enable debug logging (`enzyme.enableDebugging()` or something)
- Export a wrapper function that does it:
``` js
import enzyme, {mount, debug} from 'enzyme'
debug(enzyme)
```
- Use a special environmental variable (`process.env.ENZYME_DEBUG` or something)
Contributor guide
Research direction
No file, test, or entry point is named. Start by reviewing Enzyme's public API and the existing code paths involved in React component testing, then clarify which debug activation mechanism and output are wanted. Done would require an agreed design, implementation scope, and tests for the selected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100