jest icon indicating copy to clipboard operation
jest copied to clipboard

[Feature]: make PRINT_LIMIT configurable

Open finnigantime opened this issue 1 year ago • 1 comments

🚀 Feature Proposal

Make PRINT_LIMIT configurable via an environment variable similar to react-testing-library's DEBUG_PRINT_LIMIT. Also consider making it configurable via config file.

Motivation

See https://stackoverflow.com/questions/59763739/react-testing-library-some-portion-of-debugs-output-is-not-visible. By default RTL prints 100 lines of debug output but this is not enough to debug a large component. On the command line you can set DEBUG_PRINT_LIMIT=X to override it.

Similarly, for toHaveBeenCalledWith() and other matchers, when they fail it is sometimes not sufficient to see only 3 failed calls. This is a good default behavior, but sometimes it's handy to be able to print all the calls. In my use case I am testing a function that was called 7x. The 5th call is the one I want to validate. I am using .toHaveBeenCalledWith() and passing args. My expect is failing but it's unclear why. Because the debug output is limited to the first 3 calls I can't easily compare the expected vs actual args. Printing the full list of calls would be helpful.

Example

No response

Pitch

There is no way to configure PRINT_LIMIT currently without forking Jest. This is a small enhancement.

finnigantime avatar Jul 16 '24 23:07 finnigantime

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.

github-actions[bot] avatar Aug 16 '24 00:08 github-actions[bot]

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.

github-actions[bot] avatar Sep 15 '24 00:09 github-actions[bot]

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.

github-actions[bot] avatar Sep 15 '24 00:09 github-actions[bot]

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.

github-actions[bot] avatar Oct 16 '24 00:10 github-actions[bot]