Repository navigation
fix(node): add valueless Node CLI flags to boolean options - #2042
Merged
Merged
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
Regression tests do not cover three newly added boolean flags.
Pull request overview
Updates Node CLI parsing so valueless flags do not consume the following Jest executable.
Changes:
- Registers six additional Node boolean flags.
- Adds regression tests for representative flag combinations.
File summaries
| File | Summary |
|---|---|
packages/knip/test/util/get-inputs-from-scripts.test.ts |
Tests executable detection after representative flags; three added flags remain untested. |
packages/knip/src/plugins/node/index.ts |
Registers additional valueless Node CLI flags. |
Review details
Suppressed comments (1)
packages/knip/test/util/get-inputs-from-scripts.test.ts:85
- This regression coverage only exercises
--experimental-vm-modules,--enable-source-maps, and--expose-gc; the newly added--experimental-detect-module,--experimental-json-modules, and--openssl-legacy-providerentries are untested. Include the remaining flags here (or add separate cases) so a typo or accidental removal of any new boolean option is caught.
t('node --enable-source-maps --expose-gc node_modules/.bin/exec', [toBinary('node'), toBinary('exec')]);
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
commit: |
Member
|
Thank you! 🙏 |
Member
|
🚀 This pull request is included in v6.36.0. See Release 6.36.0 for release notes. Using Knip in a commercial project? Please consider becoming a sponsor. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Jest ESM guide recommends running Jest like this:
Knip reported
jestas an unused devDependency for such a script.--experimental-vm-modulesis a valueless flag, but it was missing from the Node plugin's boolean options, so the parser consumednode_modules/.bin/jestas its value and the binary was never attributed to the dependency.This adds a few more documented valueless Node CLI flags to the list:
--enable-source-maps,--experimental-detect-module,--experimental-json-modules,--experimental-vm-modules,--expose-gcand--openssl-legacy-provider.