diff --git a/package.json b/package.json index 65eadf6..9800177 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,8 @@ "publishConfig": { "ignore": [ ".github/workflows", - "appveyor.yml" + "appveyor.yml", + "test/resolver/malformed_package_json" ] } } diff --git a/test/resolver.js b/test/resolver.js index 35e2ebd..a339318 100644 --- a/test/resolver.js +++ b/test/resolver.js @@ -1,4 +1,5 @@ var path = require('path'); +var fs = require('fs'); var test = require('tape'); var resolve = require('../'); var async = require('../async'); @@ -555,14 +556,15 @@ test('absolute paths', function (t) { }); }); -test('malformed package.json', function (t) { +var malformedDir = path.join(__dirname, 'resolver/malformed_package_json'); +test('malformed package.json', { skip: !fs.existsSync(malformedDir) }, function (t) { /* eslint operator-linebreak: ["error", "before"], function-paren-newline: "off" */ t.plan( (3 * 3) // 3 sets of 3 assertions in the final callback + 2 // 1 readPackage call with malformed package.json ); - var basedir = path.join(__dirname, 'resolver/malformed_package_json'); + var basedir = malformedDir; var expected = path.join(basedir, 'index.js'); resolve('./index.js', { basedir: basedir }, function (err, res, pkg) { diff --git a/test/resolver_sync.js b/test/resolver_sync.js index a7c11cd..1a9fe9d 100644 --- a/test/resolver_sync.js +++ b/test/resolver_sync.js @@ -666,10 +666,11 @@ test('absolute paths', function (t) { t.end(); }); -test('malformed package.json', function (t) { +var malformedDir = path.join(__dirname, 'resolver/malformed_package_json'); +test('malformed package.json', { skip: !fs.existsSync(malformedDir) }, function (t) { t.plan(5 + (requireResolveSupportsPaths ? 1 : 0)); - var basedir = path.join(__dirname, 'resolver/malformed_package_json'); + var basedir = malformedDir; var expected = path.join(basedir, 'index.js'); t.equal(