diff --git a/test/doctool/test-make-doc.js b/test/doctool/test-make-doc.js index a11da0e97d8355..7f4f3ae6fbfdfa 100644 --- a/test/doctool/test-make-doc.js +++ b/test/doctool/test-make-doc.js @@ -12,6 +12,8 @@ const fs = require('fs'); const path = require('path'); const apiPath = path.resolve(__dirname, '..', '..', 'out', 'doc', 'api'); +const mdPath = path.resolve(__dirname, '..', '..', 'doc', 'api'); +const allMD = fs.readdirSync(mdPath); const allDocs = fs.readdirSync(apiPath); assert.ok(allDocs.includes('index.html')); @@ -22,6 +24,15 @@ const actualDocs = allDocs.filter( } ); +for (const name of actualDocs) { + if (name.startsWith('all.')) continue; + + assert.ok( + allMD.includes(name.replace(/\.\w+$/, '.md')), + `Unexpected output: out/doc/api/${name}, remove and rerun.` + ); +} + const toc = fs.readFileSync(path.resolve(apiPath, 'index.html'), 'utf8'); const re = /href="([^/]+\.html)"/; const globalRe = new RegExp(re, 'g'); @@ -43,7 +54,7 @@ for (const expectedDoc of expectedDocs) { // and that they are not empty files. for (const actualDoc of actualDocs) { assert.ok( - expectedDocs.includes(actualDoc), `${actualDoc} does not not match TOC`); + expectedDocs.includes(actualDoc), `${actualDoc} does not match TOC`); assert.ok( fs.statSync(path.join(apiPath, actualDoc)).size !== 0,