]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/ls-env.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / test / tap / ls-env.js
1 var fs = require('graceful-fs')
2 var path = require('path')
3
4 var mkdirp = require('mkdirp')
5 var mr = require('npm-registry-mock')
6 var osenv = require('osenv')
7 var rimraf = require('rimraf')
8 var test = require('tap').test
9
10 var common = require('../common-tap')
11
12 var pkg = path.resolve(__dirname, 'ls-depth')
13
14 var EXEC_OPTS = { cwd: pkg }
15
16 var json = {
17   name: 'ls-env',
18   version: '0.0.0',
19   dependencies: {
20     'test-package-with-one-dep': '0.0.0'
21   }
22 }
23
24 test('setup', function (t) {
25   cleanup()
26   mkdirp.sync(pkg)
27   fs.writeFileSync(
28     path.join(pkg, 'package.json'),
29     JSON.stringify(json, null, 2)
30   )
31   mr({port: common.port}, function (er, s) {
32     common.npm(
33       [
34         '--registry', common.registry,
35         'install'
36       ],
37       EXEC_OPTS,
38       function (er, c) {
39         t.ifError(er, 'install ran without issue')
40         t.equal(c, 0)
41         s.close()
42         t.end()
43       }
44     )
45   })
46 })
47
48 test('npm ls --dev', function (t) {
49   common.npm(['ls', '--dev'], EXEC_OPTS, function (er, code, stdout) {
50     t.ifError(er, 'ls --dev ran without issue')
51     t.equal(code, 0)
52     t.has(stdout, /(empty)/, 'output contains (empty)')
53     t.end()
54   })
55 })
56
57 test('npm ls --production', function (t) {
58   common.npm(['ls', '--production'], EXEC_OPTS, function (er, code, stdout) {
59     t.ifError(er, 'ls --production ran without issue')
60     t.notOk(code, 'npm exited ok')
61     t.has(
62       stdout,
63       /test-package-with-one-dep@0\.0\.0/,
64       'output contains test-package-with-one-dep@0.0.0'
65     )
66     t.end()
67   })
68 })
69
70 test('npm ls --prod', function (t) {
71   common.npm(['ls', '--prod'], EXEC_OPTS, function (er, code, stdout) {
72     t.ifError(er, 'ls --prod ran without issue')
73     t.notOk(code, 'npm exited ok')
74     t.has(
75       stdout,
76       /test-package-with-one-dep@0\.0\.0/,
77       'output contains test-package-with-one-dep@0.0.0'
78     )
79     t.end()
80   })
81 })
82
83 test('cleanup', function (t) {
84   cleanup()
85   t.end()
86 })
87
88 function cleanup () {
89   process.chdir(osenv.tmpdir())
90   rimraf.sync(pkg)
91 }