Skip to content

Commit 8f55596

Browse files
replace \ns with platform independeny EOLs
1 parent 6acdbef commit 8f55596

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

test/parallel/test-cli-node-cli-manpage-options.mjs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import '../common/index.mjs';
2-
import assert from 'assert';
2+
import assert from 'node:assert';
33
import { createReadStream, readFileSync } from 'node:fs';
44
import { createInterface } from 'node:readline';
55
import { resolve, join } from 'node:path';
6+
import { EOL } from "node:os";
67

78
// This test checks that all the CLI flags defined in the public CLI documentation (doc/api/cli.md)
89
// are also documented in the manpage file (doc/node.1)
@@ -83,15 +84,15 @@ for await (const line of rl) {
8384

8485
if (insideOptionsSection && isOptionLineRegex.test(line)) {
8586
if (line === '### `-`') {
86-
if (!manPageContents.includes('\n.It Sy -\n')) {
87+
if (!manPageContents.includes(`${EOL}.It Sy -${EOL}`)) {
8788
throw new Error(`The \`-\` flag is missing in the \`doc/node.1\` file`);
8889
}
8990
optionsEncountered.dash++;
9091
continue;
9192
}
9293

9394
if (line === '### `--`') {
94-
if (!manPageContents.includes('\n.It Fl -\n')) {
95+
if (!manPageContents.includes(`${EOL}.It Fl -${EOL}`)) {
9596
throw new Error(`The \`--\` flag is missing in the \`doc/node.1\` file`);
9697
}
9798
optionsEncountered.dashDash++;
@@ -107,9 +108,9 @@ for await (const line of rl) {
107108
.join(' , ')}`;
108109

109110
if (
110-
// Note: we don't check the full line (note the `\n` only at the beginning) because
111+
// Note: we don't check the full line (note the EOL only at the beginning) because
111112
// options can have arguments and we do want to ignore those
112-
!manPageContents.includes(`\n${manLine}`) &&
113+
!manPageContents.includes(`${EOL}${manLine}`) &&
113114
!flagNames.every((flag) => knownFlagsMissingFromManPage.has(flag))) {
114115
assert.fail(
115116
`The following flag${

0 commit comments

Comments
 (0)