Skip to content
Myr

test.command.helpInformation.custom.js

This file

Path

test/test.command.helpInformation.custom.js

46 lines · 1.0 KiB · JavaScript

Last changed by

Merge branch 'idmontie-feature/issue-47-add-version-help-message-override' into release/3.0.0John Geebefore adoptionafb8156

History of this file

Take it

Merge branch 'idmontie-feature/issue-47-add-version-help-message-override' into release/3.0.0John Geebefore adoptionafb8156

lines 1–46why, one step back
1var program = require('../')
2 , sinon = require('sinon').sandbox.create()3 , should = require('should');45sinon.stub(process, 'exit');6sinon.stub(process.stdout, 'write');78program.helpOption('-c, --HELP', 'custom help output');9program.command('somecommand');10program.command('anothercommand [options]');1112var expectedHelpInformation = [13 'Usage: [options] [command]',14 '',15 'Options:',16 ' -c, --HELP custom help output',17 '',18 'Commands:',19 ' somecommand',20 ' anothercommand [options]',21 ''22].join('\n');2324program.helpInformation().should.equal(expectedHelpInformation);2526// Test arguments27var expectedCommandHelpInformation = [28 'Usage: test [options] [command]',29 '',30 'Options:',31 ' -c, --HELP custom help output',32 '',33 'Commands:',34 ' somecommand',35 ' anothercommand [options]',36 ''37].join('\n');3839program.parse(['node', 'test', '--HELP']);4041process.stdout.write.called.should.equal(true);4243var output = process.stdout.write.args[0];44output[0].should.equal(expectedCommandHelpInformation);4546sinon.restore();