-
Notifications
You must be signed in to change notification settings - Fork 503
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add prerelase(v) that returns prerelease components, fixes #133
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
var tap = require('tap'); | ||
var test = tap.test; | ||
var semver = require('../semver.js'); | ||
var prerelease = semver.prerelease; | ||
|
||
test('\nprerelease', function(t) { | ||
// [prereleaseParts, version, loose] | ||
[ | ||
[['alpha', 1], '1.2.2-alpha.1'], | ||
[[1], '0.6.1-1'], | ||
[['beta', 2], '1.0.0-beta.2'], | ||
[['pre'], 'v0.5.4-pre'], | ||
[['alpha', 1], '1.2.2-alpha.1', false], | ||
[['beta'], '0.6.1beta', true], | ||
[null, '1.0.0', true], | ||
[null, '~2.0.0-alpha.1', false], | ||
[null, 'invalid version'], | ||
].forEach(function(tuple) { | ||
var expected = tuple[0]; | ||
var version = tuple[1]; | ||
var loose = tuple[2]; | ||
var msg = 'prerelease(' + version + ')'; | ||
t.same(prerelease(version, loose), expected, msg); | ||
}); | ||
t.end(); | ||
}); |