summaryrefslogtreecommitdiff
path: root/deps/npm/test/tap/outdated-include-devdependencies.js
blob: 7ab00884304b196860d5c7887de5d2acaed8270e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
var fs = require('graceful-fs')
var path = require('path')

var mkdirp = require('mkdirp')
var mr = require('npm-registry-mock')
var rimraf = require('rimraf')
var test = require('tap').test

var npm = require('../../')
var common = require('../common-tap.js')

// config
var pkg = path.resolve(__dirname, 'outdated-include-devdependencies')
var cache = path.resolve(pkg, 'cache')

var json = {
  author: 'Rocko Artischocko',
  name: 'ignore-shrinkwrap',
  version: '0.0.0',
  devDependencies: {
    underscore: '>=1.3.1'
  }
}

test('setup', function (t) {
  cleanup()
  mkdirp.sync(cache)
  fs.writeFileSync(
    path.join(pkg, 'package.json'),
    JSON.stringify(json, null, 2)
  )
  t.end()
})

test('includes devDependencies in outdated', function (t) {
  process.chdir(pkg)
  mr({ port: common.port }, function (er, s) {
    npm.load({ cache: cache, registry: common.registry }, function () {
      npm.outdated(function (er, d) {
        t.equal('1.5.1', d[0][3])
        s.close()
        t.end()
      })
    })
  })
})

test('cleanup', function (t) {
  cleanup()
  t.end()
})

function cleanup () {
  rimraf.sync(pkg)
}