Skip to content

Commit 3213c09

Browse files
rubystargos
authored andcommitted
test: provide better message for orphan output documentation
PR-URL: #21913 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Vse Mozhet Byt <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent c3d9000 commit 3213c09

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/doctool/test-make-doc.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ const fs = require('fs');
1212
const path = require('path');
1313

1414
const apiPath = path.resolve(__dirname, '..', '..', 'out', 'doc', 'api');
15+
const mdPath = path.resolve(__dirname, '..', '..', 'doc', 'api');
16+
const allMD = fs.readdirSync(mdPath);
1517
const allDocs = fs.readdirSync(apiPath);
1618
assert.ok(allDocs.includes('index.html'));
1719

@@ -22,6 +24,15 @@ const actualDocs = allDocs.filter(
2224
}
2325
);
2426

27+
for (const name of actualDocs) {
28+
if (name.startsWith('all.')) continue;
29+
30+
assert.ok(
31+
allMD.includes(name.replace(/\.\w+$/, '.md')),
32+
`Unexpected output: out/doc/api/${name}, remove and rerun.`
33+
);
34+
}
35+
2536
const toc = fs.readFileSync(path.resolve(apiPath, 'index.html'), 'utf8');
2637
const re = /href="([^/]+\.html)"/;
2738
const globalRe = new RegExp(re, 'g');
@@ -43,7 +54,7 @@ for (const expectedDoc of expectedDocs) {
4354
// and that they are not empty files.
4455
for (const actualDoc of actualDocs) {
4556
assert.ok(
46-
expectedDocs.includes(actualDoc), `${actualDoc} does not not match TOC`);
57+
expectedDocs.includes(actualDoc), `${actualDoc} does not match TOC`);
4758

4859
assert.ok(
4960
fs.statSync(path.join(apiPath, actualDoc)).size !== 0,

0 commit comments

Comments
 (0)