-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed testing for lower versions of node
- Loading branch information
1 parent
0841679
commit e63742a
Showing
1 changed file
with
16 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,22 @@ | ||
var test = require('tap').test | ||
var execSync = require('child_process').execSync | ||
var exec = require('child_process').exec | ||
|
||
test('the command line using pipes or arguments produces the same output', function (t) { | ||
var exec = 'node ./bin/semver '; | ||
[[exec+'-i 1.0.0', 'echo 1.0.0 | '+exec+'-i'], | ||
[exec+'-i major 1.0.0', 'echo 1.0.0 | '+exec+'-i major'], | ||
[exec+'-i prerelease 1.0.0', 'echo 1.0.0 | '+exec+'-i prerelease'], | ||
[exec+'-i preminor 1.0.0', 'echo 1.0.0 | '+exec+'-i preminor'], | ||
[exec+'-i prepatch --preid alpha 1.0.0', 'echo 1.0.0 | '+exec+'-i prepatch --preid alpha'], | ||
[exec+'-r \\>1.0.0 0.8.0 1.1.1', 'echo 0.8.0 1.1.1 | '+exec+'-r \\>1.0.0'] | ||
t.plan(6); | ||
var bin = 'node ./bin/semver '; | ||
[[bin+'-i 1.0.0', 'echo 1.0.0 | '+bin+'-i'], | ||
[bin+'-i major 1.0.0', 'echo 1.0.0 | '+bin+'-i major'], | ||
[bin+'-i prerelease 1.0.0', 'echo 1.0.0 | '+bin+'-i prerelease'], | ||
[bin+'-i preminor 1.0.0', 'echo 1.0.0 | '+bin+'-i preminor'], | ||
[bin+'-i prepatch --preid alpha 1.0.0', 'echo 1.0.0 | '+bin+'-i prepatch --preid alpha'], | ||
[bin+'-r \\>1.0.0 0.8.0 1.1.1', 'echo 0.8.0 1.1.1 | '+bin+'-r \\>1.0.0'] | ||
].forEach(function(tab) { | ||
var resCli = execSync(tab[0]); | ||
var resPipe = execSync(tab[1]); | ||
t.assert(resCli.equals(resPipe)); | ||
exec(tab[0], function(error, stdout, stderr) { | ||
var resCli = stdout + stderr; | ||
exec(tab[1], function(error, stdout, stderr) { | ||
var resPipe = stdout + stderr; | ||
t.assert(resCli === resPipe); | ||
}); | ||
}); | ||
}); | ||
t.end() | ||
}) |