• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1var fs = require('fs')
2var path = require('path')
3
4var mkdirp = require('mkdirp')
5var mr = require('npm-registry-mock')
6var t = require('tap')
7
8var common = require('../common-tap.js')
9
10var pkg = common.pkg
11
12var EXEC_OPTS = { cwd: pkg }
13
14var PACKAGE_JSON1 = {
15  name: 'install-cli-production-nosave',
16  version: '0.0.1',
17  dependencies: {
18  }
19}
20
21t.test('setup', function (t) {
22  mkdirp.sync(path.resolve(pkg, 'node_modules'))
23  fs.writeFileSync(
24    path.join(pkg, 'package.json'),
25    JSON.stringify(PACKAGE_JSON1, null, 2)
26  )
27  mr({ port: common.port }, function (er, s) {
28    t.ifError(er, 'started mock registry')
29    t.parent.teardown(() => s.close())
30    t.end()
31  })
32})
33
34t.test('install --production <module> without --save exits successfully', function (t) {
35  common.npm(
36    [
37      '--registry', common.registry,
38      '--loglevel', 'silent',
39      'install', '--production', 'underscore'
40    ],
41    EXEC_OPTS,
42    function (err, code) {
43      t.ifError(err, 'npm install ran without issue')
44      t.notOk(code, 'npm install exited with code 0')
45      t.end()
46    }
47  )
48})
49