node-semver icon indicating copy to clipboard operation
node-semver copied to clipboard

[BUG] Tilde Range Not Equivalent to X-Range when Including Prerelease

Open WalkerCodeRanger opened this issue 3 years ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Current Behavior

When including all prerelease versions, a tilde range like ~1.2.* does not include prerelease versions like 1.2.0-rc, but the X-range 1.2.* it is the "same as" does.

Expected Behavior

As stated by the readme and what seems to make sense for the way the >= operator works with X-ranges, ~1.2.* should include 1.2.0-rc when using the include prerelease option.

Also, note that the expected behavior is consistent with the caret operator for which ^1.2.* includes 1.2.0-rc when using the include prerelease option.

Steps To Reproduce

$semver -p -r '>=1.2.*' 1.2.0-rc
1.2.0-rc

$semver -p -r '~1.2.*' 1.2.0-rc

$semver -p -r '~1.2' 1.2.0-rc

$semver -p -r '1.2.*' 1.2.0-rc
1.2.0-rc

semver -p -r '^1.2.*' 1.2.0-rc
1.2.0-rc

Environment

  • npm: 7.3.8
  • Node: 8.11.3
  • OS: Windows Home 10.0.19044 Build 19044
  • platform: Asus Laptop

WalkerCodeRanger avatar Dec 26 '22 23:12 WalkerCodeRanger