blob: b7c11c06f846855d53a0e83a3282bd83f04ba6cc (
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
|
var cp = require('child_process')
var test = require('tape')
test('Command line: --help', function (t) {
t.plan(2)
var bin = __dirname + '/../bin/cmd.js --help'
cp.exec(bin, function (err, data) {
t.error(err) // no error, exit code 0
t.ok(data.indexOf('usage') !== 0)
})
})
test('Command line: -v --version', function (t) {
t.plan(4)
var expectedVersion = require(__dirname + '/../package.json').version + '\n'
var bin = __dirname + '/../bin/cmd.js --version'
cp.exec(bin, function (err, data) {
t.error(err) // no error, exit code 0
t.equal(data, expectedVersion)
})
bin = __dirname + '/../bin/cmd.js -v'
cp.exec(bin, function (err, data) {
t.error(err) // no error, exit code 0
t.equal(data, expectedVersion)
})
})
|