test.command.name.js
This file
Path
test/test.command.name.js
24 lines · 606 bytes · JavaScript
Last changed by
Standardize help output (#853)Jared Petersenbefore adoption713db77
History of this fileTake it
12345678910111213141516171819202122232425var program = require('../') , sinon = require('sinon').sandbox.create() , should = require('should');
sinon.stub(process, 'exit');sinon.stub(process.stdout, 'write');
program .command('mycommand [options]', 'this is my command');
program.parse(['node', 'test']);
program.name.should.be.a.Function();program.name().should.equal('test');program.commands[0].name().should.equal('mycommand');program.commands[1].name().should.equal('help');
var output = process.stdout.write.args[0];
output[0].should.containEql([ ' mycommand [options] this is my command'].join('\n'));
sinon.restore();