From cdf5ad12d722b351b41018836029012c2e9b3460 Mon Sep 17 00:00:00 2001 From: Joe Lencioni Date: Wed, 26 Oct 2022 14:14:40 -0500 Subject: [PATCH] [Tests] Add test case for symlinked node_modules with ignore Hoping to add a test case that will help us resolve some of the issues explored in https://github.com/jslicense/licensee.js/issues/70 --- tests/symlinked-node-modules/.licensee.json | 13 +++++++++++++ .../node_modules/mit-licensed/index.js | 1 + .../node_modules/mit-licensed/package.json | 8 ++++++++ tests/symlinked-node-modules/package-lock.json | 12 ++++++++++++ tests/symlinked-node-modules/package.json | 7 +++++++ tests/symlinked-node-modules/test.js | 5 +++++ 6 files changed, 46 insertions(+) create mode 100644 tests/symlinked-node-modules/.licensee.json create mode 100644 tests/symlinked-node-modules/node_modules/mit-licensed/index.js create mode 100644 tests/symlinked-node-modules/node_modules/mit-licensed/package.json create mode 100644 tests/symlinked-node-modules/package-lock.json create mode 100644 tests/symlinked-node-modules/package.json create mode 100644 tests/symlinked-node-modules/test.js diff --git a/tests/symlinked-node-modules/.licensee.json b/tests/symlinked-node-modules/.licensee.json new file mode 100644 index 0000000..12c1922 --- /dev/null +++ b/tests/symlinked-node-modules/.licensee.json @@ -0,0 +1,13 @@ +{ + "licenses": { + "spdx": [ + "Apache-2.0" + ] + }, + "packages": {}, + "ignore": [ + { + "prefix": "mit-" + } + ] +} diff --git a/tests/symlinked-node-modules/node_modules/mit-licensed/index.js b/tests/symlinked-node-modules/node_modules/mit-licensed/index.js new file mode 100644 index 0000000..d0e9332 --- /dev/null +++ b/tests/symlinked-node-modules/node_modules/mit-licensed/index.js @@ -0,0 +1 @@ +throw new Error('Do not require mit-licensed. It is just for testing license metadata.') diff --git a/tests/symlinked-node-modules/node_modules/mit-licensed/package.json b/tests/symlinked-node-modules/node_modules/mit-licensed/package.json new file mode 100644 index 0000000..dbb0145 --- /dev/null +++ b/tests/symlinked-node-modules/node_modules/mit-licensed/package.json @@ -0,0 +1,8 @@ +{ + "name": "mit-licensed", + "version": "1.0.0", + "description": "an empty package that is MIT-licensed", + "author": "Kyle E. Mitchell (https://kemitchell.com/)", + "repository": "jslicense/mit-licensed.js", + "license": "MIT" +} diff --git a/tests/symlinked-node-modules/package-lock.json b/tests/symlinked-node-modules/package-lock.json new file mode 100644 index 0000000..1b43897 --- /dev/null +++ b/tests/symlinked-node-modules/package-lock.json @@ -0,0 +1,12 @@ +{ + "name": "allowed", + "requires": true, + "lockfileVersion": 1, + "dependencies": { + "mit-licensed": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/mit-licensed/-/mit-licensed-1.0.0.tgz", + "integrity": "sha1-/YBXPYPQBMezBoFz2z6MRB13A/k=" + } + } +} diff --git a/tests/symlinked-node-modules/package.json b/tests/symlinked-node-modules/package.json new file mode 100644 index 0000000..cc7f7e2 --- /dev/null +++ b/tests/symlinked-node-modules/package.json @@ -0,0 +1,7 @@ +{ + "name": "allowed", + "dependencies": { + "mit-licensed": "1.0.0" + }, + "private": true +} diff --git a/tests/symlinked-node-modules/test.js b/tests/symlinked-node-modules/test.js new file mode 100644 index 0000000..add2337 --- /dev/null +++ b/tests/symlinked-node-modules/test.js @@ -0,0 +1,5 @@ +var tap = require('tap') + +var results = require('../run')([], __dirname) + +tap.equal(results.status, 0)