jestjs/jest

[Feature]: Detect unused stubs in test code

開放

#12,296 建立於 2022年2月3日

 (13 則留言) (10 個反應) (0 位負責人)TypeScript (6,653 個分叉)batch import
:rocket: Feature RequestHelp WantedPinned

倉庫指標

星標
 (45,361 顆星)
PR 合併指標
 (平均合併 11天 22小時) (30 天內合併 11 個 PR)

描述

🚀 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.

貢獻者指南