1 | var readInstalled = require("../read-installed.js")
|
2 | var test = require("tap").test
|
3 | var json = require("../package.json")
|
4 | var path = require("path")
|
5 | var known = [].concat(Object.keys(json.dependencies)
|
6 | , Object.keys(json.optionalDependencies)
|
7 | , Object.keys(json.devDependencies)).sort()
|
8 |
|
9 | test("make sure that it works with depth=0", function (t) {
|
10 | readInstalled(path.join(__dirname, "../"), {
|
11 | depth: 0
|
12 | }, function (er, map) {
|
13 | t.notOk(er, "er should be bull")
|
14 | t.ok(map, "map should be data")
|
15 | if (er) return console.error(er.stack || er.message)
|
16 |
|
17 | delete map.dependencies[json.name]
|
18 | var subdeps = Object.keys(map.dependencies).reduce(function(acc, dep) {
|
19 |
|
20 | delete map.dependencies[dep].dependencies[dep]
|
21 | acc += Object.keys(map.dependencies[dep].dependencies).length;
|
22 | return acc;
|
23 | }, 0);
|
24 | t.equal(subdeps, 0, "there should be no sub dependencies")
|
25 | t.end()
|
26 | })
|
27 | })
|