diff --git a/test/doctool/test-doctool-html.js b/test/doctool/test-doctool-html.js
index 499034cd8a3684..703a7dcd21acb0 100644
--- a/test/doctool/test-doctool-html.js
+++ b/test/doctool/test-doctool-html.js
@@ -95,6 +95,10 @@ const testData = [
html: '
- fish
- fish
' +
'',
},
+ {
+ file: fixtures.path('altdocs.md'),
+ html: '8.x',
+ },
];
const spaces = /\s/g;
@@ -117,7 +121,8 @@ testData.forEach(({ file, html }) => {
const actual = output.replace(spaces, '');
// Assert that the input stripped of all whitespace contains the
// expected markup.
- assert(actual.includes(expected));
+ assert(actual.includes(expected),
+ `ACTUAL: ${actual}\nEXPECTED: ${expected}`);
})
);
}));
diff --git a/test/fixtures/altdocs.md b/test/fixtures/altdocs.md
new file mode 100644
index 00000000000000..f5320533ad699c
--- /dev/null
+++ b/test/fixtures/altdocs.md
@@ -0,0 +1,2 @@
+# ALTDOCS
+
diff --git a/tools/doc/html.js b/tools/doc/html.js
index 9c9c355574d4e5..ce53bceaa24a15 100644
--- a/tools/doc/html.js
+++ b/tools/doc/html.js
@@ -427,6 +427,7 @@ function altDocs(filename, docCreated) {
const [versionMajor, versionMinor] = version.num.split('.').map(Number);
if (docCreatedMajor > versionMajor) return false;
if (docCreatedMajor < versionMajor) return true;
+ if (Number.isNaN(versionMinor)) return true;
return docCreatedMinor <= versionMinor;
}