test.command.executableSubcommand.js
This file
Path
test/test.command.executableSubcommand.js
26 lines · 562 bytes · JavaScript
Last changed by
Merge pull request #332 from zhiyelee/fixexitZhiye Libefore adoption29b4ea9
History of this fileTake it
Merge pull request #324 from zhiyelee/ttZhiye Libefore adoption2051ab0
lines 1–9why, one step back1var program = require('../')2 , util = require('util')3 , should = require('should');45var oldError = console.error;6var err = '';7console.error = function (tpl, s) {8 err = util.format(tpl, s);9};Merge pull request #332 from zhiyelee/fixexitZhiye Libefore adoption29b4ea9
lines 10–14why, one step back1011var exitCode = 0;12process.exit = function (code) {13 exitCode = code;14}Merge pull request #324 from zhiyelee/ttZhiye Libefore adoption2051ab0
lines 15–21why, one step back15program16 .command('exec [options]', 'this is my command');1718program.parse('node test exec a'.split(' '));1920program.runningCommand.on('error', function() {21 err.should.equal('\n test-exec(1) does not exist, try --help\n');Merge pull request #332 from zhiyelee/fixexitZhiye Libefore adoption29b4ea9
line 22why, one step back22 exitCode.should.equal(1);Merge pull request #324 from zhiyelee/ttZhiye Libefore adoption2051ab0
lines 23–26why, one step back23});2425// @todo test `EACCES` error26