-
-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jest configured setup scripts reporting as unused exports when --include-entry-exports is enabled #716
Comments
🚀 This issue has been resolved in v5.24.2. See Release 5.24.2 for release notes. Using Knip in a commercial project? Please consider becoming a sponsor. |
Thanks @shawnmcknight! Plugins don't perfectly always use |
@webpro Thanks for taking care of this. The originally reported issue is now fixed, but there has been a regression elsewhere. I can log a separate issue and try to create a reproduction if it helps -- just let me know. In our
The Prior to this latest change that was not being reported as an unused dependency. If you need more information let me know and I'll try to work up a reproduction. Thanks! |
The day has come..
Will fix :) |
Another fix is in the latest & greatest. |
That was really fast! Just tried it out and everything looking good! Thanks! 👍 |
I've created a reproduction for this issue at https://github.com/shawnmcknight/knip-jest-entry-exports.
Jest allows for configuration properties
globalSetup
,globalTeardown
,setupFiles
, andsetupFilesAfterEnv
(possibly others, but these are the ones I am aware of and use). The jest plugin for knip will properly detect these files referenced in the jest config as being used except when--include-entry-exports
is enabled. In my reproduction I've added a module for each of these configurable jest properties and referenced them in the jest config:When running knip with

--include-entry-exports
off, knip reports no errors in the reproduction. However, if--include-entry-exports
is enabled then knip is reporting:My interpretation of the includeEntryExports documentation is that plugins shouldn't behave differently for entry files:
Please let me know if I can provide anything else to assist with this.
The text was updated successfully, but these errors were encountered: