Welcome to mirror list, hosted at ThFree Co, Russian Federation.

lockfile-empty-dep-value.js « tap « test « npm « deps - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1e30889fcb522538f6bd432fc334251216e9e658 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
'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({
    'package-lock.json': File({
      name: 'http-locks',
      version: '1.0.0',
      lockfileVersion: 1,
      requires: true,
      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 lock file', function (t) {
  common.npm(['install'], {cwd: testdir}, function (err, code, stdout, stderr) {
    if (err) throw err
    t.match(
      stderr,
      'npm ERR! Something went wrong. Regenerate the package-lock.json with "npm install".',
      'returns message to regenerate package-lock'
    )

    t.done()
  })
})

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