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

basic.js « test « init-package-json « node_modules - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 409c16978c6fcb59e3d2fa1fd2f6db11e78e8f7b (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
var tap = require('tap')
var init = require('../')
var rimraf = require('rimraf')

tap.test('the basics', function (t) {
  var i = __dirname + '/basic.input'
  var dir = __dirname
  init(dir, i, {foo:'bar'}, function (er, data) {
    if (er) throw er
    var expect =
      { name: 'the-name',
        version: '1.2.5',
        description: 'description',
        author: 'npmbot <n@p.m> (http://npm.im)',
        scripts: { test: 'make test' },
        main: 'main.js',
        config: { foo: 'bar' },
        package: {} }
    t.same(data, expect)
    t.end()
  })
  setTimeout(function () {
    process.stdin.emit('data', 'the-name\n')
  }, 50)
  setTimeout(function () {
    process.stdin.emit('data', 'description\n')
  }, 100)
  setTimeout(function () {
    process.stdin.emit('data', 'yes\n')
  }, 150)
})

tap.test('teardown', function (t) {
  rimraf(__dirname + '/package.json', t.end.bind(t))
})