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
Merge pull request #208 from zxqfox/feature/descriptions-multiline-supportRandall Koutnikbefore adoption6134fe4
lines 1–27why, one step back1var program = require('../')2 , sinon = require('sinon').sandbox.create()3 , should = require('should');45sinon.stub(process, 'exit');6sinon.stub(process.stdout, 'write');78program9 .command('mycommand [options]', 'this is my command with\nmultiple lines in description.\nyay folks!');1011program.parse(['node', 'mycommand', '--help']);1213process.exit.calledOnce.should.be.true;14process.exit.calledWith(0).should.be.true;1516process.stdout.write.calledOnce.should.be.true;17process.stdout.write.args.length.should.equal(1);1819var output = process.stdout.write.args[0];2021sinon.restore();2223output[0].should.containEql([24 ' mycommand [options] this is my command with',25 ' multiple lines in description.',26 ' yay folks!'27].join('\n'));