[Feature]: Jest should use the `debugger` statement on failure
🚀 Feature Proposal
By default, jest should use the debugger statement on assertion failure. This could also be behind a configuration parameter.
Motivation
This would make it way easier when using a debugger to break directly on failing assertions instead of having to put breakpoints manually, or break on all "Caught exceptions" which means you would break on your own exceptions too.
Example
No response
Pitch
Some test is failing and you want to debug it.
You run it through the debugger, but the process exits right after the exception failed.
You realize you now need to put, manually, a breakpoint after finding the line throwing the assert. Worse, if you happen to have some reusable function that wraps jest's expect call, you might break many times before finally finding the call that actually causes issues.
All of this could have been avoided if you let the test framework tell the debugger when to break !
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.
Up
Huh, interesting feature request! I like it. Not sure where it would be hooked up, tho. In expect?
Ideally as close to the test code as possible or somewhere you can know what failed I guess. I suppose where the check is actually done would be OK? I'm not familiar enough with jest internals to know about that. In any case one could just go up the stack to find the faulty code!
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.
Keep issue alive
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.