summaryrefslogtreecommitdiff
path: root/deps/npm/test/tap/spawn-enoent.js
blob: c81460fdcff82b217d4c2a93c1a7593ff5c4492e (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
var path = require('path')
var test = require('tap').test
var fs = require('fs')
var rimraf = require('rimraf')
var mkdirp = require('mkdirp')
var common = require('../common-tap.js')

var pkg = path.resolve(__dirname, 'spawn-enoent')
var pj = JSON.stringify({
  name: 'x',
  version: '1.2.3',
  scripts: { start: 'wharble-garble-blorst' }
}, null, 2) + '\n'

test('setup', function (t) {
  rimraf.sync(pkg)
  mkdirp.sync(pkg)
  fs.writeFileSync(pkg + '/package.json', pj)
  t.end()
})

test('enoent script', function (t) {
  common.npm(['start'], {
    cwd: pkg,
    env: {
      PATH: process.env.PATH,
      Path: process.env.Path,
      'npm_config_loglevel': 'warn'
    }
  }, function (er, code, sout, serr) {
    t.similar(serr, /npm ERR! Failed at the x@1\.2\.3 start script\./)
    t.end()
  })
})

test('clean', function (t) {
  rimraf.sync(pkg)
  t.end()
})