Skip to content

Commit

Permalink
Merge pull request #1 from jamesr73/support_subcommand_alias_help
Browse files Browse the repository at this point in the history
Test subcommand alias help
  • Loading branch information
rike422 committed Jul 1, 2016
2 parents 81577a6 + 9ff0fd8 commit afd6f49
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/test.command.alias.help.js
@@ -0,0 +1,20 @@
var program = require('../')
, should = require('should');

program
.command('info [thing]')
.alias('i')
.action(function () {
});

program
.command('save [file]')
.alias('s')
.action(function() {
});

program.parse(['node', 'test']);

program.commandHelp().should.containEql('info|i');
program.commandHelp().should.containEql('save|s');
program.commandHelp().should.not.containEql('test|');
17 changes: 17 additions & 0 deletions test/test.command.executableSubcommandAlias.help.js
@@ -0,0 +1,17 @@
var exec = require('child_process').exec
, path = require('path')
, should = require('should');



var bin = path.join(__dirname, './fixtures/pm')

// success case
exec(bin + ' help', function (error, stdout, stderr) {
stdout.should.containEql('install|i');
stdout.should.containEql('search|s');
stdout.should.containEql('cache|c');
stdout.should.containEql('list|l');
stdout.should.containEql('publish|p');
stdout.should.not.containEql('pm|');
});

0 comments on commit afd6f49

Please sign in to comment.