test.command.executableSubcommandSubCommand.js
This file
Path
test/test.command.executableSubcommandSubCommand.js
32 lines · 850 bytes · JavaScript
Last changed by
Merge pull request #502 from bkendall/fix-sub-sub-commandsRandall Koutnikbefore adoptionc3ca1f6
History of this fileTake it
123456789101112131415161718192021222324252627282930313233var exec = require('child_process').exec , path = require('path') , should = require('should');
/* * The commands look like this * pm cache * pm cache clear * pm cache validate (default) */
var bin = path.join(__dirname, './fixtures/pm')// should list commands at top-level sub commandexec(bin + ' cache help', function (error, stdout, stderr) { stdout.should.containEql('Usage:'); stdout.should.containEql('cache'); stdout.should.containEql('validate');});
// should run sub-subcommandexec(bin + ' cache clear', function (error, stdout, stderr) { stdout.should.equal('cache-clear\n'); stderr.should.equal('');});
// should print the default command when passed invalid sub-subcommandexec(bin + ' cache nope', function (error, stdout, stderr) { stdout.should.equal('cache-validate\n'); stderr.should.equal('');});