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
Merge pull request #502 from bkendall/fix-sub-sub-commandsRandall Koutnikbefore adoptionc3ca1f6
lines 1–32why, one step back1var exec = require('child_process').exec2 , path = require('path')3 , should = require('should');456/*7 * The commands look like this8 * pm cache9 * pm cache clear10 * pm cache validate (default)11 */1213var bin = path.join(__dirname, './fixtures/pm')14// should list commands at top-level sub command15exec(bin + ' cache help', function (error, stdout, stderr) {16 stdout.should.containEql('Usage:');17 stdout.should.containEql('cache');18 stdout.should.containEql('validate');19});2021// should run sub-subcommand22exec(bin + ' cache clear', function (error, stdout, stderr) {23 stdout.should.equal('cache-clear\n');24 stderr.should.equal('');25});2627// should print the default command when passed invalid sub-subcommand28exec(bin + ' cache nope', function (error, stdout, stderr) {29 stdout.should.equal('cache-validate\n');30 stderr.should.equal('');31});32