• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict'
2
3const common = require('../common-tap.js')
4const path = require('path')
5const test = require('tap').test
6
7const Tacks = require('tacks')
8const File = Tacks.File
9const Dir = Tacks.Dir
10
11const basedir = common.pkg
12const testdir = path.join(basedir, 'testdir')
13
14const fixture = new Tacks(Dir({
15  cache: Dir(),
16  global: Dir(),
17  tmp: Dir(),
18  testdir: Dir({
19    'npm-shrinkwrap.json': File({
20      name: 'http-locks',
21      version: '0.0.0',
22      dependencies: {
23        minimist: {}
24      }
25    }),
26    'package.json': File({
27      name: 'http-locks',
28      version: '1.0.0',
29      dependencies: {
30        minimist: common.registry + '/minimist/-/minimist-0.0.5.tgz'
31      }
32    })
33  })
34}))
35
36function setup () {
37  cleanup()
38  fixture.create(basedir)
39}
40
41function cleanup () {
42  fixture.remove(basedir)
43}
44
45test('setup', function (t) {
46  setup()
47  t.done()
48})
49
50test('raises error to regenerate the shrinkwrap', function (t) {
51  common.npm(['install'], {cwd: testdir}, function (err, code, stdout, stderr) {
52    if (err) throw err
53    t.match(
54      stderr,
55      'npm ERR! If using a shrinkwrap, regenerate with "npm shrinkwrap".',
56      'returns message to regenerate shrinkwrap'
57    )
58
59    t.done()
60  })
61})
62
63test('cleanup', function (t) {
64  cleanup()
65  t.done()
66})
67