test.command.description.js
This file
Path
test/test.command.description.js
27 lines · 784 bytes · JavaScript
Last changed by
Merge pull request #208 from zxqfox/feature/descriptions-multiline-supportRandall Koutnikbefore adoption6134fe4
History of this fileTake it
12345678910111213141516171819202122232425262728var 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 with\nmultiple lines in description.\nyay folks!');
program.parse(['node', 'mycommand', '--help']);
process.exit.calledOnce.should.be.true;process.exit.calledWith(0).should.be.true;
process.stdout.write.calledOnce.should.be.true;process.stdout.write.args.length.should.equal(1);
var output = process.stdout.write.args[0];
sinon.restore();
output[0].should.containEql([ ' mycommand [options] this is my command with', ' multiple lines in description.', ' yay folks!'].join('\n'));