]> gerrit.simantics Code Review - simantics/district.git/blob - org.simantics.maps.server/node/node-v4.8.0-win-x64/node_modules/npm/test/tap/legacy-shrinkwrap.js
Adding integrated tile server
[simantics/district.git] / org.simantics.maps.server / node / node-v4.8.0-win-x64 / node_modules / npm / test / tap / legacy-shrinkwrap.js
1 'use strict'
2 var test = require('tap').test
3 var common = require('../common-tap.js')
4 var path = require('path')
5 var basepath = path.resolve(__dirname, path.basename(__filename, '.js'))
6 var Tacks = require('tacks')
7 var File = Tacks.File
8 var Dir = Tacks.Dir
9
10 var fixture = new Tacks(
11   Dir({
12     README: File(
13       'just an npm test\n'
14     ),
15     'npm-shrinkwrap.json': File({
16       name: 'npm-test-shrinkwrap',
17       version: '0.0.0',
18       dependencies: {
19         glob: {
20           version: '3.1.5',
21           from: 'git://github.com/isaacs/node-glob.git#npm-test',
22           resolved: 'git://github.com/isaacs/node-glob.git#67bda227fd7a559cca5620307c7d30a6732a792f',
23           dependencies: {
24             'graceful-fs': {
25               version: '1.1.5',
26               resolved: 'https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.1.5.tgz',
27               dependencies: {
28                 'fast-list': {
29                   version: '1.0.2',
30                   resolved: 'https://registry.npmjs.org/fast-list/-/fast-list-1.0.2.tgz'
31                 }
32               }
33             },
34             inherits: {
35               version: '1.0.0',
36               resolved: 'https://registry.npmjs.org/inherits/-/inherits-1.0.0.tgz'
37             },
38             minimatch: {
39               version: '0.2.1',
40               dependencies: {
41                 'lru-cache': {
42                   version: '1.0.5'
43                 }
44               }
45             }
46           }
47         },
48         minimatch: {
49           version: '0.1.5',
50           resolved: 'https://registry.npmjs.org/minimatch/-/minimatch-0.1.5.tgz',
51           dependencies: {
52             'lru-cache': {
53               version: '1.0.5',
54               resolved: 'https://registry.npmjs.org/lru-cache/-/lru-cache-1.0.5.tgz'
55             }
56           }
57         },
58         'npm-test-single-file': {
59           version: '1.2.3',
60           resolved: 'https://gist.github.com/isaacs/1837112/raw/9ef57a59fc22aeb1d1ca346b68826dcb638b8416/index.js'
61         }
62       }
63     }),
64     'package.json': File({
65       author: 'Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)',
66       name: 'npm-test-shrinkwrap',
67       version: '0.0.0',
68       dependencies: {
69         'npm-test-single-file': 'https://gist.github.com/isaacs/1837112/raw/9ef57a59fc22aeb1d1ca346b68826dcb638b8416/index.js',
70         glob: 'git://github.com/isaacs/node-glob.git#npm-test',
71         minimatch: '~0.1.0'
72       },
73       scripts: {
74         test: 'node test.js'
75       }
76     })
77   })
78 )
79
80 test('setup', function (t) {
81   setup()
82   t.done()
83 })
84
85 test('shrinkwrap', function (t) {
86   common.npm(['install'], {cwd: basepath}, installCheckAndTest)
87
88   function installCheckAndTest (err, code, stdout, stderr) {
89     if (err) throw err
90     console.error(stderr)
91     t.is(code, 0, 'install went ok')
92
93     common.npm(['ls', '--json'], {cwd: basepath}, verifyLsMatchesShrinkwrap)
94   }
95
96   function verifyLsMatchesShrinkwrap (err, code, stdout, stderr) {
97     if (err) throw err
98     console.error(stderr)
99     t.is(code, 0, 'ls went ok')
100     var actual = JSON.parse(stdout)
101     var expected = require(path.resolve(basepath, 'npm-shrinkwrap.json'))
102     // from is expected to vary
103     t.isDeeply(
104       common.rmFromInShrinkwrap(actual),
105       common.rmFromInShrinkwrap(expected)
106     )
107     t.done()
108   }
109 })
110
111 test('cleanup', function (t) {
112   cleanup()
113   t.done()
114 })
115
116 function setup () {
117   cleanup()
118   fixture.create(basepath)
119 }
120
121 function cleanup () {
122   fixture.remove(basepath)
123 }