diff --git a/lib/translators/npm.js b/lib/translators/npm.js index 60642d898..2bfa3c081 100644 --- a/lib/translators/npm.js +++ b/lib/translators/npm.js @@ -52,7 +52,7 @@ class NpmTranslator { } } // When UI5-dependencies are defined, we don't care whether an npm dependency is optional or not. - // All UI5-dependendies need to be there. + // All UI5-dependencies need to be there. dependencies = Object.assign({}, dependencies, optDependencies); optDependencies = {}; diff --git a/test/fixtures/cyclic-deps/node_modules/application.cycle.a/package.json b/test/fixtures/cyclic-deps/node_modules/application.cycle.a/package.json new file mode 100644 index 000000000..05ce5b9a9 --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/application.cycle.a/package.json @@ -0,0 +1,12 @@ +{ + "name": "application.cycle.a", + "version": "1.0.0", + "description": "Simple SAPUI5 based application - Test for cyclic UI5 dependencies", + "main": "index.html", + "dependencies": { + "component.cycle.a": "file:../component.cycle.a" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + } +} diff --git a/test/fixtures/cyclic-deps/node_modules/application.cycle.a/ui5.yaml b/test/fixtures/cyclic-deps/node_modules/application.cycle.a/ui5.yaml new file mode 100644 index 000000000..16ac128fb --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/application.cycle.a/ui5.yaml @@ -0,0 +1,5 @@ +--- +specVersion: "0.1" +type: application +metadata: + name: application.cycle.a diff --git a/test/fixtures/cyclic-deps/node_modules/application.cycle.a/webapp/index.html b/test/fixtures/cyclic-deps/node_modules/application.cycle.a/webapp/index.html new file mode 100644 index 000000000..daa631f7b --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/application.cycle.a/webapp/index.html @@ -0,0 +1,9 @@ + + + + Application Cycle A + + + + + diff --git a/test/fixtures/cyclic-deps/node_modules/application.cycle.a/webapp/test.js b/test/fixtures/cyclic-deps/node_modules/application.cycle.a/webapp/test.js new file mode 100644 index 000000000..a3df410c3 --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/application.cycle.a/webapp/test.js @@ -0,0 +1,5 @@ +function test(paramA) { + var variableA = paramA; + console.log(variableA); +} +test(); diff --git a/test/fixtures/cyclic-deps/node_modules/application.cycle.b/package.json b/test/fixtures/cyclic-deps/node_modules/application.cycle.b/package.json new file mode 100644 index 000000000..691d79e56 --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/application.cycle.b/package.json @@ -0,0 +1,13 @@ +{ + "name": "application.cycle.b", + "version": "1.0.0", + "description": "Simple SAPUI5 based application - Test for cyclic npm (non-UI5) dependencies - Cycle on second level via dev dependency", + "main": "index.html", + "dependencies": { + "module.d": "file:../module.d", + "module.e": "file:../module.e" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + } +} diff --git a/test/fixtures/cyclic-deps/node_modules/application.cycle.b/ui5.yaml b/test/fixtures/cyclic-deps/node_modules/application.cycle.b/ui5.yaml new file mode 100644 index 000000000..557b0aa63 --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/application.cycle.b/ui5.yaml @@ -0,0 +1,5 @@ +--- +specVersion: "0.1" +type: application +metadata: + name: application.cycle.b diff --git a/test/fixtures/cyclic-deps/node_modules/application.cycle.b/webapp/index.html b/test/fixtures/cyclic-deps/node_modules/application.cycle.b/webapp/index.html new file mode 100644 index 000000000..fb845822a --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/application.cycle.b/webapp/index.html @@ -0,0 +1,9 @@ + + + + Application Cycle B + + + + + diff --git a/test/fixtures/cyclic-deps/node_modules/application.cycle.b/webapp/test.js b/test/fixtures/cyclic-deps/node_modules/application.cycle.b/webapp/test.js new file mode 100644 index 000000000..a3df410c3 --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/application.cycle.b/webapp/test.js @@ -0,0 +1,5 @@ +function test(paramA) { + var variableA = paramA; + console.log(variableA); +} +test(); diff --git a/test/fixtures/cyclic-deps/node_modules/application.cycle.c/package.json b/test/fixtures/cyclic-deps/node_modules/application.cycle.c/package.json new file mode 100644 index 000000000..be7d0f8d2 --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/application.cycle.c/package.json @@ -0,0 +1,15 @@ +{ + "name": "application.cycle.c", + "version": "1.0.0", + "description": "Simple SAPUI5 based application - Test for cyclic npm (non-UI5) dependencies - Cycle on third level", + "_ui5_test_comment": "This scenario can't be tested using file: URLs as npm can't create cyclic symlinks.", + "_ui5_test_comment2": "However publishing to and installing from a registry works.", + "main": "index.html", + "dependencies": { + "module.f": "^1.0.0", + "module.g": "^1.0.0" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + } +} diff --git a/test/fixtures/cyclic-deps/node_modules/application.cycle.c/ui5.yaml b/test/fixtures/cyclic-deps/node_modules/application.cycle.c/ui5.yaml new file mode 100644 index 000000000..44420029d --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/application.cycle.c/ui5.yaml @@ -0,0 +1,5 @@ +--- +specVersion: "0.1" +type: application +metadata: + name: application.cycle.c diff --git a/test/fixtures/cyclic-deps/node_modules/application.cycle.c/webapp/index.html b/test/fixtures/cyclic-deps/node_modules/application.cycle.c/webapp/index.html new file mode 100644 index 000000000..a845ac425 --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/application.cycle.c/webapp/index.html @@ -0,0 +1,9 @@ + + + + Application Cycle C + + + + + diff --git a/test/fixtures/cyclic-deps/node_modules/application.cycle.c/webapp/test.js b/test/fixtures/cyclic-deps/node_modules/application.cycle.c/webapp/test.js new file mode 100644 index 000000000..a3df410c3 --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/application.cycle.c/webapp/test.js @@ -0,0 +1,5 @@ +function test(paramA) { + var variableA = paramA; + console.log(variableA); +} +test(); diff --git a/test/fixtures/cyclic-deps/node_modules/component.cycle.a/package.json b/test/fixtures/cyclic-deps/node_modules/component.cycle.a/package.json new file mode 100644 index 000000000..5aa7c632a --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/component.cycle.a/package.json @@ -0,0 +1,15 @@ +{ + "name": "component.cycle.a", + "version": "1.0.0", + "description": "Simple SAPUI5 based library - Test for cyclic dependencies", + "dependencies": { + "library.cycle.a": "file:../library.cycle.a", + "library.cycle.b": "file:../library.cycle.b" + }, + "devDependencies": { + "application.cycle.a": "file:../application.cycle.a" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + } +} diff --git a/test/fixtures/cyclic-deps/node_modules/component.cycle.a/src/component/cycle/a/.library b/test/fixtures/cyclic-deps/node_modules/component.cycle.a/src/component/cycle/a/.library new file mode 100644 index 000000000..e2eb7bd4c --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/component.cycle.a/src/component/cycle/a/.library @@ -0,0 +1,11 @@ + + + + component.cycle.a + SAP SE + ${copyright} + ${version} + + Component Cycle A + + diff --git a/test/fixtures/cyclic-deps/node_modules/component.cycle.a/src/component/cycle/a/some.js b/test/fixtures/cyclic-deps/node_modules/component.cycle.a/src/component/cycle/a/some.js new file mode 100644 index 000000000..81e734360 --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/component.cycle.a/src/component/cycle/a/some.js @@ -0,0 +1,4 @@ +/*! + * ${copyright} + */ +console.log('HelloWorld'); \ No newline at end of file diff --git a/test/fixtures/cyclic-deps/node_modules/component.cycle.a/test/component/cycle/a/Test.html b/test/fixtures/cyclic-deps/node_modules/component.cycle.a/test/component/cycle/a/Test.html new file mode 100644 index 000000000..e69de29bb diff --git a/test/fixtures/cyclic-deps/node_modules/component.cycle.a/ui5.yaml b/test/fixtures/cyclic-deps/node_modules/component.cycle.a/ui5.yaml new file mode 100644 index 000000000..87e92d6d1 --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/component.cycle.a/ui5.yaml @@ -0,0 +1,9 @@ +--- +specVersion: "0.1" +type: library +metadata: + name: component.cycle.a + copyright: |- + UI development toolkit for HTML5 (OpenUI5) + * (c) Copyright 2009-xxx SAP SE or an SAP affiliate company. + * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. diff --git a/test/fixtures/cyclic-deps/node_modules/library.cycle.a/package.json b/test/fixtures/cyclic-deps/node_modules/library.cycle.a/package.json new file mode 100644 index 000000000..075a4ecc6 --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/library.cycle.a/package.json @@ -0,0 +1,11 @@ +{ + "name": "library.cycle.a", + "version": "1.0.0", + "description": "Simple SAPUI5 based library - Test for cyclic dependencies", + "devDependencies": { + "component.cycle.a": "file:../component.cycle.a" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + } +} diff --git a/test/fixtures/cyclic-deps/node_modules/library.cycle.a/src/cycle/a/.library b/test/fixtures/cyclic-deps/node_modules/library.cycle.a/src/cycle/a/.library new file mode 100644 index 000000000..5fd459a0d --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/library.cycle.a/src/cycle/a/.library @@ -0,0 +1,11 @@ + + + + library.cycle.a + SAP SE + ${copyright} + ${version} + + Library Cycle A + + diff --git a/test/fixtures/cyclic-deps/node_modules/library.cycle.a/src/cycle/a/some.js b/test/fixtures/cyclic-deps/node_modules/library.cycle.a/src/cycle/a/some.js new file mode 100644 index 000000000..81e734360 --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/library.cycle.a/src/cycle/a/some.js @@ -0,0 +1,4 @@ +/*! + * ${copyright} + */ +console.log('HelloWorld'); \ No newline at end of file diff --git a/test/fixtures/cyclic-deps/node_modules/library.cycle.a/test/cycle/a/Test.html b/test/fixtures/cyclic-deps/node_modules/library.cycle.a/test/cycle/a/Test.html new file mode 100644 index 000000000..e69de29bb diff --git a/test/fixtures/cyclic-deps/node_modules/library.cycle.a/ui5.yaml b/test/fixtures/cyclic-deps/node_modules/library.cycle.a/ui5.yaml new file mode 100644 index 000000000..124aef34f --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/library.cycle.a/ui5.yaml @@ -0,0 +1,9 @@ +--- +specVersion: "0.1" +type: library +metadata: + name: library.cycle.a + copyright: |- + UI development toolkit for HTML5 (OpenUI5) + * (c) Copyright 2009-xxx SAP SE or an SAP affiliate company. + * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. diff --git a/test/fixtures/cyclic-deps/node_modules/library.cycle.b/package.json b/test/fixtures/cyclic-deps/node_modules/library.cycle.b/package.json new file mode 100644 index 000000000..5c96c9658 --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/library.cycle.b/package.json @@ -0,0 +1,11 @@ +{ + "name": "library.cycle.b", + "version": "1.0.0", + "description": "Simple SAPUI5 based library - Test for cyclic dependencies", + "devDependencies": { + "component.cycle.a": "file:../component.cycle.a" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + } +} diff --git a/test/fixtures/cyclic-deps/node_modules/library.cycle.b/src/cycle/b/.library b/test/fixtures/cyclic-deps/node_modules/library.cycle.b/src/cycle/b/.library new file mode 100644 index 000000000..bc47d278e --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/library.cycle.b/src/cycle/b/.library @@ -0,0 +1,11 @@ + + + + library.cycle.b + SAP SE + ${copyright} + ${version} + + Library Cycle B + + diff --git a/test/fixtures/cyclic-deps/node_modules/library.cycle.b/src/cycle/b/some.js b/test/fixtures/cyclic-deps/node_modules/library.cycle.b/src/cycle/b/some.js new file mode 100644 index 000000000..81e734360 --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/library.cycle.b/src/cycle/b/some.js @@ -0,0 +1,4 @@ +/*! + * ${copyright} + */ +console.log('HelloWorld'); \ No newline at end of file diff --git a/test/fixtures/cyclic-deps/node_modules/library.cycle.b/test/cycle/b/Test.html b/test/fixtures/cyclic-deps/node_modules/library.cycle.b/test/cycle/b/Test.html new file mode 100644 index 000000000..e69de29bb diff --git a/test/fixtures/cyclic-deps/node_modules/library.cycle.b/ui5.yaml b/test/fixtures/cyclic-deps/node_modules/library.cycle.b/ui5.yaml new file mode 100644 index 000000000..13ef9e228 --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/library.cycle.b/ui5.yaml @@ -0,0 +1,9 @@ +--- +specVersion: "0.1" +type: library +metadata: + name: library.cycle.b + copyright: |- + UI development toolkit for HTML5 (OpenUI5) + * (c) Copyright 2009-xxx SAP SE or an SAP affiliate company. + * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. diff --git a/test/fixtures/cyclic-deps/node_modules/module.a/package.json b/test/fixtures/cyclic-deps/node_modules/module.a/package.json new file mode 100644 index 000000000..8c1b6acef --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/module.a/package.json @@ -0,0 +1,11 @@ +{ + "name": "module.a", + "version": "1.0.0", + "description": "Simple npm module - Test for cyclic npm (non-UI5) dependencies - cycle via module.c", + "dependencies": { + "module.b": "^1.0.0" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + } +} diff --git a/test/fixtures/cyclic-deps/node_modules/module.b/package.json b/test/fixtures/cyclic-deps/node_modules/module.b/package.json new file mode 100644 index 000000000..d81d5b4d0 --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/module.b/package.json @@ -0,0 +1,11 @@ +{ + "name": "module.b", + "version": "1.0.0", + "description": "Simple npm module - Test for cyclic npm (non-UI5) dependencies", + "dependencies": { + "module.c": "^1.0.0" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + } +} diff --git a/test/fixtures/cyclic-deps/node_modules/module.c/package.json b/test/fixtures/cyclic-deps/node_modules/module.c/package.json new file mode 100644 index 000000000..d186194e6 --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/module.c/package.json @@ -0,0 +1,11 @@ +{ + "name": "module.c", + "version": "1.0.0", + "description": "Simple npm module - Test for cyclic npm (non-UI5) dependencies- cycle via module.a", + "dependencies": { + "module.a": "^1.0.0" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + } +} diff --git a/test/fixtures/cyclic-deps/node_modules/module.d/package.json b/test/fixtures/cyclic-deps/node_modules/module.d/package.json new file mode 100644 index 000000000..f591d59bf --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/module.d/package.json @@ -0,0 +1,11 @@ +{ + "name": "module.d", + "version": "1.0.0", + "description": "Simple npm module - Test for cyclic npm (non-UI5) dependencies - cycle with module.e", + "dependencies": { + "module.e": "file:../module.e" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + } +} diff --git a/test/fixtures/cyclic-deps/node_modules/module.e/package.json b/test/fixtures/cyclic-deps/node_modules/module.e/package.json new file mode 100644 index 000000000..f72159ade --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/module.e/package.json @@ -0,0 +1,11 @@ +{ + "name": "module.e", + "version": "1.0.0", + "description": "Simple npm module - Test for cyclic npm (non-UI5) dependencies - cycle with module.d", + "devDependencies": { + "module.d": "file:../module.d" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + } +} diff --git a/test/fixtures/cyclic-deps/node_modules/module.f/package.json b/test/fixtures/cyclic-deps/node_modules/module.f/package.json new file mode 100644 index 000000000..29ff93f8b --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/module.f/package.json @@ -0,0 +1,11 @@ +{ + "name": "module.f", + "version": "1.0.0", + "description": "Simple npm module - Test for cyclic npm (non-UI5) dependencies - cycle via module.c", + "dependencies": { + "module.a": "^1.0.0" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + } +} diff --git a/test/fixtures/cyclic-deps/node_modules/module.g/package.json b/test/fixtures/cyclic-deps/node_modules/module.g/package.json new file mode 100644 index 000000000..92ba49c94 --- /dev/null +++ b/test/fixtures/cyclic-deps/node_modules/module.g/package.json @@ -0,0 +1,11 @@ +{ + "name": "module.g", + "version": "1.0.0", + "description": "Simple npm module - Test for cyclic npm (non-UI5) dependencies - cycle via module.c", + "dependencies": { + "module.a": "^1.0.0" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + } +} diff --git a/test/lib/translators/npm.js b/test/lib/translators/npm.js index 9ede9412f..ec6da82b4 100644 --- a/test/lib/translators/npm.js +++ b/test/lib/translators/npm.js @@ -55,6 +55,185 @@ test("AppG: project with npm 'optionalDependencies' should not fail if optional }); }); +test("AppCycle: cyclic dev deps", (t) => { + const cycleDepsBasePath = path.join(__dirname, "..", "..", "fixtures", "cyclic-deps", "node_modules"); + const applicationCycleAPath = path.join(cycleDepsBasePath, "application.cycle.a"); + + const applicationCycleTree = { + "id": "application.cycle.a", + "version": "1.0.0", + "path": applicationCycleAPath, + "dependencies": [ + { + "id": "component.cycle.a", + "version": "1.0.0", + "path": path.join(cycleDepsBasePath, "component.cycle.a"), + "dependencies": [ + { + "id": "library.cycle.a", + "version": "1.0.0", + "path": path.join(cycleDepsBasePath, "library.cycle.a"), + "dependencies": [ + { + "id": "component.cycle.a", + "version": "1.0.0", + "path": path.join(cycleDepsBasePath, "component.cycle.a"), + "dependencies": [], + "deduped": true + } + ] + }, + { + "id": "library.cycle.b", + "version": "1.0.0", + "path": path.join(cycleDepsBasePath, "library.cycle.b"), + "dependencies": [ + { + "id": "component.cycle.a", + "version": "1.0.0", + "path": path.join(cycleDepsBasePath, "component.cycle.a"), + "dependencies": [], + "deduped": true + } + ] + }, + { + "id": "application.cycle.a", + "version": "1.0.0", + "path": applicationCycleAPath, + "dependencies": [], + "deduped": true + } + ] + } + ] + }; + + return npmTranslator.generateDependencyTree(applicationCycleAPath).then((parsedTree) => { + t.deepEqual(parsedTree, applicationCycleTree, "Parsed correctly"); + }); +}); + +test("AppCycle: cyclic npm deps - Cycle via devDependency on second level", (t) => { + const cycleDepsBasePath = path.join(__dirname, "..", "..", "fixtures", "cyclic-deps", "node_modules"); + const applicationCycleBPath = path.join(cycleDepsBasePath, "application.cycle.b"); + + const applicationCycleB = { + id: "application.cycle.b", + version: "1.0.0", + path: applicationCycleBPath, + dependencies: [] + }; + + const moduleD = { + id: "module.d", + version: "1.0.0", + path: path.join(cycleDepsBasePath, "module.d"), + dependencies: [] + }; + + const moduleE = { + id: "module.e", + version: "1.0.0", + path: path.join(cycleDepsBasePath, "module.e"), + dependencies: [] + }; + + applicationCycleB.dependencies.push(moduleD, moduleE); + moduleD.dependencies.push(moduleE); + moduleE.dependencies.push(moduleD); + + const applicationCycleTree = applicationCycleB; + return npmTranslator.generateDependencyTree(applicationCycleBPath).then((parsedTree) => { + t.deepEqual(parsedTree, applicationCycleTree, "Parsed correctly"); + }); +}); + +test("AppCycle: cyclic npm deps - Cycle on third level (one indirection)", (t) => { + const cycleDepsBasePath = path.join(__dirname, "..", "..", "fixtures", "cyclic-deps", "node_modules"); + const applicationCycleCPath = path.join(cycleDepsBasePath, "application.cycle.c"); + + const applicationCycleTree = { + "id": "application.cycle.c", + "version": "1.0.0", + "path": path.join(cycleDepsBasePath, "application.cycle.c"), + "dependencies": [ + { + "id": "module.f", + "version": "1.0.0", + "path": path.join(cycleDepsBasePath, "module.f"), + "dependencies": [ + { + "id": "module.a", + "version": "1.0.0", + "path": path.join(cycleDepsBasePath, "module.a"), + "dependencies": [ + { + "id": "module.b", + "version": "1.0.0", + "path": path.join(cycleDepsBasePath, "module.b"), + "dependencies": [ + { + "id": "module.c", + "version": "1.0.0", + "path": path.join(cycleDepsBasePath, "module.c"), + "dependencies": [ + { + "id": "module.a", + "version": "1.0.0", + "path": path.join(cycleDepsBasePath, "module.a"), + "dependencies": [], + "deduped": true + } + ] + } + ] + } + ] + } + ] + }, + { + "id": "module.g", + "version": "1.0.0", "path": path.join(cycleDepsBasePath, "module.g"), + "dependencies": [ + { + "id": "module.a", + "version": "1.0.0", + "path": path.join(cycleDepsBasePath, "module.a"), + "dependencies": [ + { + "id": "module.b", + "version": "1.0.0", + "path": path.join(cycleDepsBasePath, "module.b"), + "dependencies": [ + { + "id": "module.c", + "version": "1.0.0", + "path": path.join(cycleDepsBasePath, "module.c"), + "dependencies": [ + { + "id": "module.a", + "version": "1.0.0", + "path": path.join(cycleDepsBasePath, "module.a"), + "dependencies": [], + "deduped": true + } + ] + } + ] + } + ] + } + ] + } + ] + }; + return npmTranslator.generateDependencyTree(applicationCycleCPath).then((parsedTree) => { + t.deepEqual(parsedTree, applicationCycleTree, "Parsed correctly"); + }); +}); + test("Error: missing package.json", async (t) => { const dir = path.parse(__dirname).root; const error = await t.throws(npmTranslator.generateDependencyTree(dir));