Skip to content
Prev Previous commit
Next Next commit
test: adjust CLI flags test to ignore blank lines in doc
PR-URL: #40403
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 Oct 20, 2021
commit 3f7c503b69b9fe3db560d1e7a6103233d223773e
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