summaryrefslogtreecommitdiff
path: root/test/doctool/test-make-doc.js
diff options
context:
space:
mode:
authorSam Ruby <rubys@intertwingly.net>2018-07-20 13:43:05 -0400
committerRich Trott <rtrott@gmail.com>2018-07-23 12:51:11 -0700
commitc57e11c2f6a5353b1be0e056322f327e736cf623 (patch)
treefd2d8329c8b419c8e92cde464c50d704ad58faa6 /test/doctool/test-make-doc.js
parent0e4cbde13b9177075eaf86d96d8e26ac424a65df (diff)
downloadandroid-node-v8-c57e11c2f6a5353b1be0e056322f327e736cf623.tar.gz
android-node-v8-c57e11c2f6a5353b1be0e056322f327e736cf623.tar.bz2
android-node-v8-c57e11c2f6a5353b1be0e056322f327e736cf623.zip
test: provide better message for orphan output documentation
PR-URL: https://github.com/nodejs/node/pull/21913 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/doctool/test-make-doc.js')
-rw-r--r--test/doctool/test-make-doc.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/doctool/test-make-doc.js b/test/doctool/test-make-doc.js
index a11da0e97d..7f4f3ae6fb 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,