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
Backport-PR-URL: #40530
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
Trott authored and targos committed Nov 4, 2021
1 parent 8226690 commit 6de88bc
Showing 1 changed file with 4 additions and 1 deletion.
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 6de88bc

Please sign in to comment.