Skip to content

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

Description

@WalkerCodeRanger

Is there an existing issue for this?

  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds an initial review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions