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

[BUG] Inconsistent behaviour of caret versions with includePrerelease

Open adamreeve opened this issue 2 years ago • 0 comments

Is there an existing issue for this?

  • [X] 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

adamreeve avatar May 02 '23 23:05 adamreeve