npm: Upgrade to 1.3.19
[platform/upstream/nodejs.git] / deps / npm / test / tap / outdated-depth.js
1 var common = require('../common-tap')
2   , path = require('path')
3   , test = require('tap').test
4   , rimraf = require('rimraf')
5   , npm = require('../../')
6   , mr = require('npm-registry-mock')
7   , pkg = path.resolve(__dirname, 'outdated-depth')
8
9 function cleanup () {
10   rimraf.sync(pkg + '/node_modules')
11   rimraf.sync(pkg + '/cache')
12 }
13
14 test('outdated depth zero', function (t) {
15   var expected = [
16     pkg,
17     'underscore',
18     '1.3.1',
19     '1.3.1',
20     '1.5.1',
21     '1.3.1'
22   ]
23
24   process.chdir(pkg)
25
26   mr(common.port, function (s) {
27     npm.load({
28       cache: pkg + '/cache'
29     , loglevel: 'silent'
30     , registry: common.registry
31     , depth: 0
32     }
33     , function () {
34         npm.install('.', function (er) {
35           if (er) throw new Error(er)
36           npm.outdated(function (err, d) {
37             if (err) throw new Error(err)
38             t.deepEqual(d[0], expected)
39             s.close()
40             t.end()
41           })
42         })
43       }
44     )
45   })
46 })
47
48 test("cleanup", function (t) {
49   cleanup()
50   t.end()
51 })