Repository navigation
Commit 046da7f
authored
fix: align caret includePrerelease lower bounds (#872)
## Summary
- keep exact caret lower bounds at the release version when
`includePrerelease` is enabled
- add regression fixtures for `^0.0.3` and `^0.2.3` prerelease versions
matching the existing `^1.0.0` behavior
## Root Cause
For exact `0.x` caret ranges without an explicit prerelease,
`replaceCaret` appended `-0` to the lower bound when `includePrerelease`
was enabled. That turned `^0.0.3` into `>=0.0.3-0 <0.0.4-0`, allowing
`0.0.3-alpha` while exact `1.x` caret ranges kept `>=1.2.3` and rejected
`1.2.3-alpha`.
## Test Plan
- RED: Node assert script confirmed `satisfies('0.0.3-alpha', '^0.0.3',
{ includePrerelease: true })` returned `true` before the fix
- GREEN: Node assert script for `0.0.3-alpha`, `0.2.3-alpha`, and
`1.2.3-alpha` all returning `false`
- `node` fixture script covering range include/exclude fixtures: 121
include and 98 exclude cases
- broader `node` range verification script: 1348 checks across range
parsing, intersects, outside/gtr/ltr, min/max satisfying, and
toComparators
- `git diff --check HEAD^ HEAD`
Fixes #5571 parent efafcf8 commit 046da7f
2 files changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
373 | 373 | | |
374 | 374 | | |
375 | 375 | | |
376 | | - | |
| 376 | + | |
377 | 377 | | |
378 | 378 | | |
379 | | - | |
| 379 | + | |
380 | 380 | | |
381 | 381 | | |
382 | 382 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| |||
0 commit comments