node/deps/npm/node_modules/read-installed/test/depth-1.js
isaacs bd547d6598 npm: upgrade to 1.4.6
* Documentation upgrades
* Fix glob bug which prevents proper README publishing
* node-gyp upgrade to 0.13
* Documentation updates
* Add --save-exact to save an exact dep (instead of a range)
* alias 't' to 'test'
2014-03-25 17:42:22 -07:00

24 lines
826 B
JavaScript

var readInstalled = require("../read-installed.js")
var test = require("tap").test
var json = require("../package.json")
var path = require("path")
var known = [].concat(Object.keys(json.dependencies)
, Object.keys(json.optionalDependencies)
, Object.keys(json.devDependencies)).sort()
test("make sure that it works with depth=1", function (t) {
readInstalled(path.join(__dirname, "../"), {
depth: 1
}, function (er, map) {
t.notOk(er, "er should be bull")
t.ok(map, "map should be data")
if (er) return console.error(er.stack || er.message)
var subdeps = Object.keys(map.dependencies).reduce(function(acc, dep) {
acc += Object.keys(map.dependencies[dep].dependencies).length;
return acc;
}, 0);
t.notEqual(subdeps, 0, "there should some sub dependencies")
t.end()
})
})