-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
test: ensure that CLI options are alphabetical #55790
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -123,6 +123,20 @@ for (const [, envVar, config] of nodeOptionsCC.matchAll(addOptionRE)) { | |||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
const start = /^## Options/m; | ||||||||||||||||||||||||||||||||||||||||||||||||
const end = /^## Environment variables/m; | ||||||||||||||||||||||||||||||||||||||||||||||||
const filteredCLIText = cliText.slice(cliText.search(start), cliText.search(end)).trim(); | ||||||||||||||||||||||||||||||||||||||||||||||||
const cliOptionPattern = /^### `(--[a-zA-Z0-9-]+)`/mg; | ||||||||||||||||||||||||||||||||||||||||||||||||
const options = Array.from(filteredCLIText.matchAll(cliOptionPattern)).map((match) => match[1]); | ||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
const sortedOptions = [...options].sort(); | ||||||||||||||||||||||||||||||||||||||||||||||||
/* eslint-disable no-restricted-syntax */ | ||||||||||||||||||||||||||||||||||||||||||||||||
assert.deepStrictEqual(options, sortedOptions, 'CLI options are not in alphabetical order'); | ||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+134
to
+136
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should not disable lint rules like that:
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+127
to
+137
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMO we also want env variables and V8 options to be sorted, it makes little sense to reduce it to our CLI options
Suggested change
I can also do that as part of a follow-up PR |
||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
// add alias handling | ||||||||||||||||||||||||||||||||||||||||||||||||
manPagesOptions.delete('-trace-events-enabled'); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trimming is not useful, is it?