test: adjust CLI flags test to ignore blank lines in doc

PR-URL: https://github.com/nodejs/node/pull/40403
Backport-PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
Rich Trott authored and Michaël Zasso committed 2021-11-04 12:22:59 +01:00
1 parent 8226690097
commit 6de88bc5ed
1 file changed
+4 -1
@@ -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,
@@ -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());