• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1var readInstalled = require("../read-installed.js")
2var test = require("tap").test
3var json = require("../package.json")
4var path = require("path")
5var known = [].concat(Object.keys(json.dependencies)
6  , Object.keys(json.optionalDependencies)
7  , Object.keys(json.devDependencies)).sort()
8
9test("make sure that it works with depth=1", function (t) {
10  readInstalled(path.join(__dirname, "../"), {
11    depth: 1
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    var subdeps = Object.keys(map.dependencies).reduce(function(acc, dep) {
17      acc += Object.keys(map.dependencies[dep].dependencies).length;
18      return acc;
19    }, 0);
20    t.notEqual(subdeps, 0, "there should some sub dependencies")
21    t.end()
22  })
23})
24