kentcdodds / kentcdodds/kcd-scripts
Jest emits validation warnings in precommit hook due to unknown option "watchPlugins"
- Dominant language
- JavaScript
- Stars
- 889
- Forks
- 205
- PR merge metrics
- No merged PRs in 30d
Description
When running the precommit hook in [@testing-library/jest-dom](https://github.com/testing-library/jest-dom), I noticed this warning:
```
✖ kcd-scripts test --findRelatedTests:
● Validation Warning:
Unknown option "watchPlugins" with value ["/Users/trevor.burnham/code/jest-dom/node_modules/jest-watch-typeahead/build/file_name_plugin/plugin.js", "/Users/trevor.burnham/code/jest-dom/node_modules/jest-watch-typeahead/build/test_name_plugin/plugin.js"] was found.
This is probably a typing mistake. Fixing it will remove this message.
Configuration Documentation:
https://jestjs.io/docs/configuration
```
That configuration option is set here: https://github.com/kentcdodds/kcd-scripts/blob/530b9ea2055af62721831605a3616cbe722bf3fb/src/config/jest.config.js#L43-L46
Honestly I'm puzzled by this warning. `npx jest --version` returns `29.7.0`, and the docs for that version show `watchPlugins` as a valid configuration option: https://jestjs.io/docs/29.7/configuration#watchplugins-arraystring--string-object
Additionally, I only see the warning when `kcd-scripts test` runs in the precommit hook. If I run `npx kcd-scripts test --run`, there's no such warning.
Contributor guide
Research direction
Start with src/config/jest.config.js at the linked watchPlugins configuration and compare how the precommit hook runs kcd-scripts test with the direct npx kcd-scripts test --run command. Trace the differing Jest configuration or execution path, then verify that the precommit hook no longer emits the validation warning while the related-test behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100