test.command.usage.description.js
This file
Path
test/test.command.usage.description.js
28 lines · 774 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–28why, 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('cmd', 'usage doesn\'t work without description ;-(')10 .usage('[options] \\\n | xargs send --message \'yay folks!\' \\\n | wc -l');1112program.parse(['node', 'cmd', '--help']);1314process.exit.calledOnce.should.be.true;15process.exit.calledWith(0).should.be.true;1617process.stdout.write.calledOnce.should.be.true;18process.stdout.write.args.length.should.equal(1);1920var output = process.stdout.write.args[0];2122sinon.restore();2324output[0].should.containEql([25 ' Usage: cmd [options] \\',26 ' | xargs send --message \'yay folks!\' \\',27 ' | wc -l'28].join('\n'));