-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
94 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
var program = require('../') | ||
, should = require('should'); | ||
|
||
program | ||
.command('info [thing]') | ||
.alias('i') | ||
.action(function () { | ||
}); | ||
|
||
program | ||
.command('save [file]') | ||
.alias('s') | ||
.action(function() { | ||
}); | ||
|
||
program.parse(['node', 'test']); | ||
|
||
program.commandHelp().should.containEql('info|i'); | ||
program.commandHelp().should.containEql('save|s'); | ||
program.commandHelp().should.not.containEql('test|'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var exec = require('child_process').exec | ||
, path = require('path') | ||
, should = require('should'); | ||
|
||
|
||
|
||
var bin = path.join(__dirname, './fixtures/pm') | ||
|
||
// success case | ||
exec(bin + ' help', function (error, stdout, stderr) { | ||
stdout.should.containEql('install|i'); | ||
stdout.should.containEql('search|s'); | ||
stdout.should.containEql('cache|c'); | ||
stdout.should.containEql('list'); | ||
stdout.should.containEql('publish|p'); | ||
stdout.should.not.containEql('pm|'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
var exec = require('child_process').exec | ||
, path = require('path') | ||
, should = require('should'); | ||
|
||
var bin = path.join(__dirname, './fixtures/pm') | ||
|
||
// success case | ||
exec(bin + ' i', function (error, stdout, stderr) { | ||
stdout.should.equal('install\n'); | ||
}); | ||
|
||
// subcommand bin file with explicit extension | ||
exec(bin + ' p', function (error, stdout, stderr) { | ||
stdout.should.equal('publish\n'); | ||
}); | ||
|
||
// spawn EACCES | ||
exec(bin + ' s', function (error, stdout, stderr) { | ||
// error info are not the same in between <v0.10 and v0.12 | ||
should.notEqual(0, stderr.length); | ||
}); | ||
|
||
// when `bin` is a symbol link for mocking global install | ||
var bin = path.join(__dirname, './fixtures/pmlink') | ||
// success case | ||
exec(bin + ' i', function (error, stdout, stderr) { | ||
stdout.should.equal('install\n'); | ||
}); |