From 657fd7aee948229ebf6e63f98959501dd9fc68b5 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 8 Jun 2016 11:15:36 +0200 Subject: [PATCH] test: skip doctool tests when js-yaml is missing Skip the doctool tests when js-yaml, which is currently `require()`d from the eslint source tree, is missing. This can happen, for example, because eslint is not included in the release source tarballs. Fixes: https://github.com/nodejs/node/issues/7201 Ref: https://github.com/nodejs/node/pull/6495 PR-URL: https://github.com/nodejs/node/pull/7218 Reviewed-By: Roman Reiss Reviewed-By: Sakthipriyan Vairamani --- test/doctool/test-doctool-html.js | 7 +++++++ test/doctool/test-doctool-json.js | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/test/doctool/test-doctool-html.js b/test/doctool/test-doctool-html.js index 91b9e0de6d3777..bd21e21d9563d2 100644 --- a/test/doctool/test-doctool-html.js +++ b/test/doctool/test-doctool-html.js @@ -5,6 +5,13 @@ const assert = require('assert'); const fs = require('fs'); const path = require('path'); +// The doctool currently uses js-yaml from the tool/eslint/ tree. +try { + require('../../tools/eslint/node_modules/js-yaml'); +} catch (e) { + return common.skip('missing js-yaml (eslint not present)'); +} + const processIncludes = require('../../tools/doc/preprocess.js'); const html = require('../../tools/doc/html.js'); diff --git a/test/doctool/test-doctool-json.js b/test/doctool/test-doctool-json.js index 7b9fbeb019f1e1..520c79bef8bcda 100644 --- a/test/doctool/test-doctool-json.js +++ b/test/doctool/test-doctool-json.js @@ -5,6 +5,13 @@ const assert = require('assert'); const fs = require('fs'); const path = require('path'); +// The doctool currently uses js-yaml from the tool/eslint/ tree. +try { + require('../../tools/eslint/node_modules/js-yaml'); +} catch (e) { + return common.skip('missing js-yaml (eslint not present)'); +} + const json = require('../../tools/doc/json.js'); // Outputs valid json with the expected fields when given simple markdown