test.command.executableSubcommandSpecifySubcommand.js
This file
Path
test/test.command.executableSubcommandSpecifySubcommand.js
44 lines · 1.2 KiB · JavaScript
Last changed by
Merge pull request #999 from shadowspawn/feature/specifyExecutableFileJohn Geebefore adoption831d52f
History of this fileTake it
123456789101112131415161718192021222324252627282930313233343536373839404142434445var exec = require('child_process').exec , path = require('path') , should = require('should');
var bin = path.join(__dirname, './fixtures/pm')// success caseexec(bin + ' specifyInstall', function(error, stdout, stderr) { // Optionally specify `pm-install` stdout.should.equal('install\n');});exec(bin + ' specifyPublish', function(error, stdout, stderr) { // Optionally specify `pm-publish` stdout.should.equal('publish\n');});
// not existexec(bin + ' list', function (error, stdout, stderr) { //stderr.should.equal('\n pm-list(1) does not exist, try --help\n\n'); should.notEqual(0, stderr.length);});
// success caseexec(bin + ' install', function (error, stdout, stderr) { stdout.should.equal('install\n');});
// subcommand bin file with explicit extensionexec(bin + ' publish', function (error, stdout, stderr) { stdout.should.equal('publish\n');});
// spawn EACCESexec(bin + ' search', function (error, stdout, stderr) { should.notEqual(0, stderr.length);});
// when `bin` is a symbol link for mocking global installvar bin = path.join(__dirname, './fixtures/pmlink')// success caseexec(bin + ' install', function (error, stdout, stderr) { stdout.should.equal('install\n');});