Skip to content

Commit

Permalink
[Tests] avoid publishing "malformed package.json" test to avoid flawe…
Browse files Browse the repository at this point in the history
…d security scanners

Fixes #319.
Fixes #318.
Fixes #317.
Fixes #314.
Closes #313.
Fixes #312.
Fixes #311.
Fixes #310.
Fixes #309.
Fixes #306.
Fixes #305.
Fixes #304.
Fixes #303.
Fixes #291.
Fixes #288.
  • Loading branch information
ljharb committed Sep 28, 2023
1 parent 2ae67c1 commit 9e6f936
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
"publishConfig": {
"ignore": [
".github/workflows",
"appveyor.yml"
"appveyor.yml",
"test/resolver/malformed_package_json"
]
}
}
6 changes: 4 additions & 2 deletions test/resolver.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var path = require('path');
var fs = require('fs');
var test = require('tape');
var resolve = require('../');
var async = require('../async');
Expand Down Expand Up @@ -539,14 +540,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) {
Expand Down
5 changes: 3 additions & 2 deletions test/resolver_sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -667,10 +667,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(
Expand Down

0 comments on commit 9e6f936

Please sign in to comment.