test.command.executableSubcommandDefault.js
This file
Path
test/test.command.executableSubcommandDefault.js
46 lines · 1.3 KiB · JavaScript
Last changed by
Merge pull request #415 from Qix-/default-subcommandRandall Koutnikbefore adoption0af40a5
History of this fileTake it
Merge pull request #415 from Qix-/default-subcommandRandall Koutnikbefore adoption0af40a5
lines 1–46why, one step back1var exec = require('child_process').exec2 , path = require('path')3 , should = require('should');4567var bin = path.join(__dirname, './fixtures/pm')8// success case9exec(bin + ' default', function(error, stdout, stderr) {10 stdout.should.equal('default\n');11});1213// success case (default)14exec(bin, function(error, stdout, stderr) {15 stdout.should.equal('default\n');16});1718// not exist19exec(bin + ' list', function (error, stdout, stderr) {20 //stderr.should.equal('\n pm-list(1) does not exist, try --help\n\n');21 // TODO error info are not the same in between <=v0.8 and later version22 should.notEqual(0, stderr.length);23});2425// success case26exec(bin + ' install', function (error, stdout, stderr) {27 stdout.should.equal('install\n');28});2930// subcommand bin file with explicit extension31exec(bin + ' publish', function (error, stdout, stderr) {32 stdout.should.equal('publish\n');33});3435// spawn EACCES36exec(bin + ' search', function (error, stdout, stderr) {37 // TODO error info are not the same in between <v0.10 and v0.1238 should.notEqual(0, stderr.length);39});4041// when `bin` is a symbol link for mocking global install42var bin = path.join(__dirname, './fixtures/pmlink')43// success case44exec(bin + ' install', function (error, stdout, stderr) {45 stdout.should.equal('install\n');46});