• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict'
2var test = require('tap').test
3var Tacks = require('tacks')
4var Dir = Tacks.Dir
5var File = Tacks.File
6var common = require('../common-tap.js')
7
8var testdir = common.pkg
9var fixture = new Tacks(Dir({
10  node_modules: Dir({
11    a: Dir({
12      'package.json': File({
13        name: 'a',
14        version: '1.0.0',
15        dependencies: {
16          b: '1.0.0'
17        }
18      }),
19      node_modules: Dir({
20        b: Dir({
21          'package.json': File({
22            name: 'b',
23            version: '1.0.0'
24          })
25        })
26      })
27    })
28  }),
29  'b-src': Dir({
30    'package.json': File({
31      name: 'b',
32      author: 'Author Contributor',
33      contributors: [
34        {name: 'Author Contributor'},
35        'Another Contributor'
36      ],
37      version: '1.0.0'
38    })
39  })
40}))
41
42function setup () {
43  cleanup()
44  fixture.create(testdir)
45}
46
47function cleanup () {
48  fixture.remove(testdir)
49}
50
51test('setup', function (t) {
52  setup()
53  t.end()
54})
55
56test('install', function (t) {
57  common.npm(['install', '--no-save', './b-src'], {cwd: testdir}, function (err, code, stdout, stderr) {
58    if (err) throw err
59    t.is(code, 0, 'installed successfully')
60    t.is(stderr, '', 'no warnings')
61    t.includes(stdout, 'added 1 package from 2 contributors', 'lists number of unique contributors')
62    t.end()
63  })
64})
65
66test('cleanup', function (t) {
67  cleanup()
68  t.end()
69})
70