test.command.name.js
This file
Path
test/test.command.name.js
24 lines · 605 bytes · JavaScript
Last changed by
Merge pull request #382 from claylo/masterRandall Koutnikbefore adoptionb91f7db
History of this fileTake it
Merge pull request #264 from tonylukasavage/name_funcThomas Geraghtybefore adoptionf1d6a0c
line 1why, one step back1var program = require('../')Merge pull request #382 from claylo/masterRandall Koutnikbefore adoptionb91f7db
line 2why, one step back2 , sinon = require('sinon').sandbox.create()Merge pull request #264 from tonylukasavage/name_funcThomas Geraghtybefore adoptionf1d6a0c
lines 3–4why, one step back3 , should = require('should');4Merge pull request #382 from claylo/masterRandall Koutnikbefore adoptionb91f7db
lines 5–7why, one step back5sinon.stub(process, 'exit');6sinon.stub(process.stdout, 'write');7Merge pull request #264 from tonylukasavage/name_funcThomas Geraghtybefore adoptionf1d6a0c
lines 8–16why, one step back8program9 .command('mycommand [options]', 'this is my command');1011program.parse(['node', 'test']);1213program.name.should.be.a.Function;14program.name().should.equal('test');15program.commands[0].name().should.equal('mycommand');16program.commands[1].name().should.equal('help');Merge pull request #382 from claylo/masterRandall Koutnikbefore adoptionb91f7db
lines 17–24why, one step back1718var output = process.stdout.write.args[0];1920output[0].should.containEql([21 ' mycommand [options] this is my command'22].join('\n'));2324sinon.restore();