mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
test: ensure cli.md is in alphabetical order
Co-authored-by: RedYetiDev <redyetidev@gmail.com> PR-URL: https://github.com/nodejs/node/pull/56025 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
1 parent
59d6891872
commit
046e642a80
2 files changed
+119
-104
No files matched your search
@@ -123,6 +123,21 @@ for (const [, envVar, config] of nodeOptionsCC.matchAll(addOptionRE)) {
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
const sections = /^## (.+)$/mg;
|
||||
const cliOptionPattern = /^### (?:`-\w.*`, )?`([^`]+)`/mg;
|
||||
let match;
|
||||
let previousIndex = 0;
|
||||
do {
|
||||
const sectionTitle = match?.[1];
|
||||
match = sections.exec(cliText);
|
||||
const filteredCLIText = cliText.slice(previousIndex, match?.index);
|
||||
const options = Array.from(filteredCLIText.matchAll(cliOptionPattern), (match) => match[1]);
|
||||
assert.deepStrictEqual(options, options.toSorted(), `doc/api/cli.md ${sectionTitle} subsections are not in alphabetical order`);
|
||||
previousIndex = match?.index;
|
||||
} while (match);
|
||||
}
|
||||
|
||||
// add alias handling
|
||||
manPagesOptions.delete('-trace-events-enabled');
|
||||
|
||||
|
||||
Reference in new issue
Block a user