1var test = require('tap').test 2var common = require('../common-tap.js') 3 4var opts = { cwd: process.cwd() } 5 6test('npm asdf should return exit code 1', function (t) { 7 common.npm(['asdf'], opts, function (err, code, stdout, stderr) { 8 if (err) throw err 9 t.ok(code, 'exit code should not be zero') 10 if (stdout.trim()) t.comment(stdout.trim()) 11 if (stderr.trim()) t.comment(stderr.trim()) 12 t.end() 13 }) 14}) 15 16test('npm help should return exit code 0', function (t) { 17 common.npm(['help'], opts, function (err, code, stdout, stderr) { 18 if (err) throw err 19 t.equal(code, 0, 'exit code should be 0') 20 if (stdout.trim()) t.comment(stdout.trim()) 21 if (stderr.trim()) t.comment(stderr.trim()) 22 t.end() 23 }) 24}) 25 26test('npm help fadf should return exit code 0', function (t) { 27 common.npm(['help', 'fadf'], opts, function (err, code, stdout, stderr) { 28 if (err) throw err 29 t.equal(code, 0, 'exit code should be 0') 30 if (stdout.trim()) t.comment(stdout.trim()) 31 if (stderr.trim()) t.comment(stderr.trim()) 32 t.end() 33 }) 34}) 35