• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1var fs = require('graceful-fs')
2var path = require('path')
3
4var mkdirp = require('mkdirp')
5var mr = require('npm-registry-mock')
6var rimraf = require('rimraf')
7var test = require('tap').test
8
9var npm = require('../../')
10var common = require('../common-tap.js')
11
12// config
13var pkg = path.resolve(__dirname, 'outdated-include-devdependencies')
14var cache = path.resolve(pkg, 'cache')
15
16var json = {
17  author: 'Rocko Artischocko',
18  name: 'ignore-shrinkwrap',
19  version: '0.0.0',
20  devDependencies: {
21    underscore: '>=1.3.1'
22  }
23}
24
25test('setup', function (t) {
26  cleanup()
27  mkdirp.sync(cache)
28  fs.writeFileSync(
29    path.join(pkg, 'package.json'),
30    JSON.stringify(json, null, 2)
31  )
32  t.end()
33})
34
35test('includes devDependencies in outdated', function (t) {
36  process.chdir(pkg)
37  mr({ port: common.port }, function (er, s) {
38    npm.load({ cache: cache, registry: common.registry }, function () {
39      npm.outdated(function (er, d) {
40        t.ifError(er, 'npm outdated completed successfully')
41        t.is(process.exitCode, 1, 'exitCode set to 1')
42        process.exitCode = 0
43        t.equal('1.5.1', d[0][3])
44        s.close()
45        t.end()
46      })
47    })
48  })
49})
50
51test('cleanup', function (t) {
52  cleanup()
53  t.end()
54})
55
56function cleanup () {
57  rimraf.sync(pkg)
58}
59