diff options
author | isaacs <i@izs.me> | 2014-05-07 05:17:22 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2014-05-07 05:18:04 +0400 |
commit | e1160eba7ac481a0c0523774cdfc53e1dd054104 (patch) | |
tree | fc3223e98c14c3b41eb2f300a69f3f9a65593dbd /node_modules/semver/test | |
parent | 79a102f922c5c53576773a9d212a513a7d6a5894 (diff) |
semver@2.3.0
This adds the "prerelease", "prepatch", "preminor", "premajor" options
for `npm version`.
Diffstat (limited to 'node_modules/semver/test')
-rw-r--r-- | node_modules/semver/test/index.js | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/node_modules/semver/test/index.js b/node_modules/semver/test/index.js index e6c9cefb0..6285b693f 100644 --- a/node_modules/semver/test/index.js +++ b/node_modules/semver/test/index.js @@ -302,8 +302,15 @@ test('\nincrement versions test', function(t) { ['1.2.3tag', 'major', '2.0.0', true], ['1.2.3-tag', 'major', '2.0.0'], ['1.2.3', 'fake', null], + ['1.2.0-0', 'patch', '1.2.0'], ['fake', 'major', null], - ['1.2.3', 'prerelease', '1.2.3-0'], + ['1.2.3-4', 'major', '2.0.0'], + ['1.2.3-4', 'minor', '1.3.0'], + ['1.2.3-4', 'patch', '1.2.3'], + ['1.2.3-alpha.0.beta', 'major', '2.0.0'], + ['1.2.3-alpha.0.beta', 'minor', '1.3.0'], + ['1.2.3-alpha.0.beta', 'patch', '1.2.3'], + ['1.2.4', 'prerelease', '1.2.5-0'], ['1.2.3-0', 'prerelease', '1.2.3-1'], ['1.2.3-alpha.0', 'prerelease', '1.2.3-alpha.1'], ['1.2.3-alpha.1', 'prerelease', '1.2.3-alpha.2'], @@ -319,7 +326,13 @@ test('\nincrement versions test', function(t) { ['1.2.3-alpha.10.beta.2', 'prerelease', '1.2.3-alpha.10.beta.3'], ['1.2.3-alpha.9.beta', 'prerelease', '1.2.3-alpha.10.beta'], ['1.2.3-alpha.10.beta', 'prerelease', '1.2.3-alpha.11.beta'], - ['1.2.3-alpha.11.beta', 'prerelease', '1.2.3-alpha.12.beta'] + ['1.2.3-alpha.11.beta', 'prerelease', '1.2.3-alpha.12.beta'], + ['1.2.0', 'preminor', '1.3.0-0'], + ['1.2.0', 'premajor', '2.0.0-0'], + ['1.2.0', 'preminor', '1.3.0-0'], + ['1.2.0', 'premajor', '2.0.0-0'] + + ].forEach(function(v) { var pre = v[0]; var what = v[1]; @@ -500,6 +513,21 @@ test('\ncomparators test', function(t) { t.end(); }); +test('\ninvalid version numbers', function(t) { + ['1.2.3.4', + 'NOT VALID', + 1.2, + null, + 'Infinity.NaN.Infinity' + ].forEach(function(v) { + t.throws(function() { + new SemVer(v); + }, {name:'TypeError', message:'Invalid Version: ' + v}); + }); + + t.end(); +}); + test('\nstrict vs loose version numbers', function(t) { [['=1.2.3', '1.2.3'], ['01.02.03', '1.2.3'], |