Skip to content

Commit

Permalink
test: fix man page check
Browse files Browse the repository at this point in the history
* The -vv option breaks the test because it expects --vv. So make an
  exception for that one.
* --policies isn't used anymore, so remove it from the man page.
  • Loading branch information
trevnorris committed Oct 3, 2024
1 parent af4c1aa commit 5162d9a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 0 additions & 3 deletions doc/nsolid.1
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,6 @@ Print node's version.
.\"=====================================================================
.Sh N|SOLID OPTIONS
.Bl -tag -width 6n
.It Fl -policies Ar file
Activates the requested N|Solid policies as specified in the provided file.
.
.It Fl vv
Print the N|Solid release version.
.El
Expand Down
6 changes: 4 additions & 2 deletions test/parallel/test-cli-node-options-docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const addOptionRE = /AddOption[\s\n\r]*\([\s\n\r]*"([^"]+)"(.*?)\);/gs;
const nodeOptionsText = cliText.match(/<!-- node-options-node start -->(.*)<!-- node-options-others end -->/s)[1];
const v8OptionsText = cliText.match(/<!-- v8-options start -->(.*)<!-- v8-options end -->/s)[1];

const manPage = path.join(rootDir, 'doc', 'node.1');
const manPage = path.join(rootDir, 'doc', 'nsolid.1');
const manPageText = fs.readFileSync(manPage, { encoding: 'utf8' });

// Documented in /doc/api/deprecations.md
Expand Down Expand Up @@ -82,7 +82,9 @@ for (const [, envVar, config] of nodeOptionsCC.matchAll(addOptionRE)) {
// CLI options
if (!isV8Option && !hasTrueAsDefaultValue) {
if (new RegExp(`###.*\`${envVar}[[=\\s\\b\`]`).test(cliText) === false) {
assert(false, `Should have option ${envVar} documented`);
if (envVar !== '-vv') {
assert(false, `Should have option ${envVar} documented`);
}
} else {
manPagesOptions.delete(envVar.slice(1));
}
Expand Down

0 comments on commit 5162d9a

Please sign in to comment.