Skip to content

Commit

Permalink
add test for regenerate message for shrinkwrap file
Browse files Browse the repository at this point in the history
  • Loading branch information
Danielle Adams committed Apr 1, 2020
1 parent d0ecfbd commit 4c2a0e8
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions test/tap/shrinkwrap-empty-dep-value.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
'use strict'

const common = require('../common-tap.js')
const path = require('path')
const test = require('tap').test

const Tacks = require('tacks')
const File = Tacks.File
const Dir = Tacks.Dir

const basedir = common.pkg
const testdir = path.join(basedir, 'testdir')

const fixture = new Tacks(Dir({
cache: Dir(),
global: Dir(),
tmp: Dir(),
testdir: Dir({
'npm-shrinkwrap.json': File({
name: 'http-locks',
version: '0.0.0',
dependencies: {
minimist: {}
}
}),
'package.json': File({
name: 'http-locks',
version: '1.0.0',
dependencies: {
minimist: common.registry + '/minimist/-/minimist-0.0.5.tgz'
}
})
})
}))

function setup () {
cleanup()
fixture.create(basedir)
}

function cleanup () {
fixture.remove(basedir)
}

test('setup', function (t) {
setup()
t.done()
})

test('raises error to regenerate the shrinkwrap', function (t) {
common.npm(['install'], {cwd: testdir}, function (err, code, stdout, stderr) {
t.match(
stderr,
'npm ERR! If using a shrinkwrap, regenerate with "npm shrinkwrap".',
'returns message to regenerate shrinkwrap'
)

t.done()
})
})

test('cleanup', function (t) {
cleanup()
t.done()
})

0 comments on commit 4c2a0e8

Please sign in to comment.