Skip to content

Commit

Permalink
Adding several tests for various 'pre-release' situations.
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelzulliger authored and isaacs committed Apr 14, 2020
1 parent 92bccf1 commit 4131ecc
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 3 deletions.
17 changes: 17 additions & 0 deletions test/fixtures/range-exclude.js
Expand Up @@ -13,6 +13,7 @@ module.exports = [
['^1.2.3', '1.2.3-beta'],
['=0.7.x', '0.7.0-asdf'],
['>=0.7.x', '0.7.0-asdf'],
['<=0.7.x', '0.7.0-asdf'],
['1', '1.0.0beta', { loose: 420 }],
['<1', '1.0.0beta', true],
['< 1', '1.0.0beta', true],
Expand Down Expand Up @@ -85,4 +86,20 @@ module.exports = [
['1 - 2', '2.0.0-pre'],
['1 - 2', '1.0.0-pre'],
['1.0 - 2', '1.0.0-pre'],

['1.1.x', '1.0.0-a'],
['1.1.x', '1.1.0-a'],
['1.1.x', '1.2.0-a'],
['1.1.x', '1.2.0-a', { includePrerelease: true }],
['1.1.x', '1.0.0-a', { includePrerelease: true }],
['1.x', '1.0.0-a'],
['1.x', '1.1.0-a'],
['1.x', '1.2.0-a'],
['1.x', '0.0.0-a', { includePrerelease: true }],
['1.x', '2.0.0-a', { includePrerelease: true }],

['>=1.0.0 <1.1.0', '1.1.0'],
['>=1.0.0 <1.1.0', '1.1.0', { includePrerelease: true }],
['>=1.0.0 <1.1.0', '1.1.0-pre'],
['>=1.0.0 <1.1.0-pre', '1.1.0-pre'],
]
8 changes: 8 additions & 0 deletions test/fixtures/range-include.js
Expand Up @@ -109,6 +109,8 @@ module.exports = [
['<=7.x', '7.9.9'],
['2.x', '2.0.0-pre.0', { includePrerelease: true }],
['2.x', '2.1.0-pre.0', { includePrerelease: true }],
['1.1.x', '1.1.0-a', { includePrerelease: true }],
['1.1.x', '1.1.1-a', { includePrerelease: true }],
['*', '1.0.0-rc1', { includePrerelease: true }],
['^1.0.0-0', '1.0.1-rc1', { includePrerelease: true }],
['^1.0.0-rc2', '1.0.1-rc1', { includePrerelease: true }],
Expand All @@ -117,4 +119,10 @@ module.exports = [
['1 - 2', '2.0.0-pre', { includePrerelease: true }],
['1 - 2', '1.0.0-pre', { includePrerelease: true }],
['1.0 - 2', '1.0.0-pre', { includePrerelease: true }],

['=0.7.x', '0.7.0-asdf', { includePrerelease: true }],
['>=0.7.x', '0.7.0-asdf', { includePrerelease: true }],
['<=0.7.x', '0.7.0-asdf', { includePrerelease: true }],

['>=1.0.0 <=1.1.0', '1.1.0-pre', { includePrerelease: true }],
]
3 changes: 2 additions & 1 deletion test/fixtures/version-gt-range.js
Expand Up @@ -60,5 +60,6 @@ module.exports = [
['<1', '1.0.0beta', true],
['< 1', '1.0.0beta', true],
['=0.7.x', '0.8.2'],
['<0.7.x', '0.7.2']
['<0.7.x', '0.7.2'],
['0.7.x', '0.7.2-beta']
]
3 changes: 2 additions & 1 deletion test/fixtures/version-not-gt-range.js
Expand Up @@ -81,5 +81,6 @@ module.exports = [
['^0.1.0 || ~3.0.1 || 5.0.0', '3.2.0'],
['^0.1.0 || ~3.0.1 || 5.0.0', '1.0.0beta', true],
['^0.1.0 || ~3.0.1 || 5.0.0', '5.0.0-0', true],
['^0.1.0 || ~3.0.1 || >4 <=5.0.0', '3.5.0']
['^0.1.0 || ~3.0.1 || >4 <=5.0.0', '3.5.0'],
['0.7.x', '0.7.2-beta', { includePrerelease: true }]
]
3 changes: 2 additions & 1 deletion test/fixtures/version-not-lt-range.js
Expand Up @@ -84,5 +84,6 @@ module.exports = [
['~1.0.0-alpha', '1.0.0beta', true],
['^1.0.0-alpha', '1.0.0-beta'],
['~1.0.0-alpha', '1.0.0-beta'],
['=0.1.0', '1.0.0']
['=0.1.0', '1.0.0'],
['>1.2.3', '1.3.0-alpha', { includePrerelease: true }]
]

0 comments on commit 4131ecc

Please sign in to comment.