jestjs/jest

[Feature]: Detect unused stubs in test code

Open

#12.296 aperta il 3 feb 2022

Vedi su GitHub
 (13 commenti) (10 reazioni) (0 assegnatari)TypeScript (6653 fork)batch import
:rocket: Feature RequestHelp WantedPinned

Metriche repository

Star
 (45.361 star)
Metriche merge PR
 (Merge medio 11g 22h) (11 PR mergiate in 30 g)

Descrizione

🚀 Feature Proposal

As described in this article, JUnit and Mockito support detecting unnecessary stubs and tell the user to remove them. It would be great to have that feature in Jest.

Motivation

Removing unused stubs makes the test code cleaner and more maintainable.

Example

No response

Pitch

Removing unused stubs makes the test code cleaner and more maintainable. This leads to users writing cleaner and more delightful tests and prevents certain errors from happening when users expect their stubs to be responsible for a specific behavior when actually they have never been called.

Guida contributor