From 3213c09e3a2537905e7e2a989649d6ddb629d04f Mon Sep 17 00:00:00 2001 From: Sam Ruby Date: Fri, 20 Jul 2018 13:43:05 -0400 Subject: [PATCH] test: provide better message for orphan output documentation PR-URL: https://github.com/nodejs/node/pull/21913 Reviewed-By: Ruben Bridgewater Reviewed-By: Vse Mozhet Byt Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott Reviewed-By: Trivikram Kamat Reviewed-By: James M Snell --- test/doctool/test-make-doc.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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,