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')
10 var fixture = new Tacks(
15 'npm-shrinkwrap.json': File({
16 name: 'npm-test-shrinkwrap',
21 from: 'git://github.com/isaacs/node-glob.git#npm-test',
22 resolved: 'git://github.com/isaacs/node-glob.git#67bda227fd7a559cca5620307c7d30a6732a792f',
26 resolved: 'https://registry.npmjs.org/graceful-fs/-/graceful-fs-1.1.5.tgz',
30 resolved: 'https://registry.npmjs.org/fast-list/-/fast-list-1.0.2.tgz'
36 resolved: 'https://registry.npmjs.org/inherits/-/inherits-1.0.0.tgz'
50 resolved: 'https://registry.npmjs.org/minimatch/-/minimatch-0.1.5.tgz',
54 resolved: 'https://registry.npmjs.org/lru-cache/-/lru-cache-1.0.5.tgz'
58 'npm-test-single-file': {
60 resolved: 'https://gist.github.com/isaacs/1837112/raw/9ef57a59fc22aeb1d1ca346b68826dcb638b8416/index.js'
64 'package.json': File({
65 author: 'Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)',
66 name: 'npm-test-shrinkwrap',
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',
80 test('setup', function (t) {
85 test('shrinkwrap', function (t) {
86 common.npm(['install'], {cwd: basepath}, installCheckAndTest)
88 function installCheckAndTest (err, code, stdout, stderr) {
91 t.is(code, 0, 'install went ok')
93 common.npm(['ls', '--json'], {cwd: basepath}, verifyLsMatchesShrinkwrap)
96 function verifyLsMatchesShrinkwrap (err, code, stdout, 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
104 common.rmFromInShrinkwrap(actual),
105 common.rmFromInShrinkwrap(expected)
111 test('cleanup', function (t) {
118 fixture.create(basepath)
121 function cleanup () {
122 fixture.remove(basepath)