Skip to content

Commit

Permalink
test: adjust CLI flags test to ignore blank lines in doc
Browse files Browse the repository at this point in the history
PR-URL: #40403
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Zijian Liu <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
Trott authored and targos committed Oct 20, 2021
1 parent adbd92e commit 3f7c503
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ const parseSection = (text, startMarker, endMarker) => {
const match = text.match(regExp);
assert(match,
`Unable to locate text between '${startMarker}' and '${endMarker}'.`);
return match[1].split(/\r?\n/);
return match[1]
.split(/\r?\n/)
.filter((val) => val.trim() !== '');
};

const nodeOptionsLines = parseSection(cliText,
Expand All @@ -24,6 +26,7 @@ const nodeOptionsLines = parseSection(cliText,
const v8OptionsLines = parseSection(cliText,
'<!-- node-options-v8 start -->',
'<!-- node-options-v8 end -->');

// Check the options are documented in alphabetical order.
assert.deepStrictEqual(nodeOptionsLines, [...nodeOptionsLines].sort());
assert.deepStrictEqual(v8OptionsLines, [...v8OptionsLines].sort());
Expand Down

0 comments on commit 3f7c503

Please sign in to comment.