Skip to content

[BUG] Inconsistent behaviour of caret versions with includePrerelease #557

Description

@adamreeve

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

The behaviour of satisfies when using a caret range with includePrerease: true seems to depend on whether a major version number is present:

> semver.satisfies('0.0.3-alpha', '^0.0.3', {includePrerelease: true})
true
> semver.satisfies('0.2.3-alpha', '^0.2.3', {includePrerelease: true})
true
> semver.satisfies('1.2.3-alpha', '^1.2.3', {includePrerelease: true})
false

Expected Behavior

I'd expect the above calls to all return false, for consistency with the reasoning in #409

Steps To Reproduce

No response

Environment

  • semver: 7.5.0
  • npm: 8.5.1
  • Node: 12.22.9
  • OS: Ubuntu 22.04.2

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