[BUG] semver.lt returns wrong value for pre-release version comparison #483
Open
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
Using semver.lt()
returns the incorrect value when comparing pre-release version with includePrerelease
set to false (or the default).
By comparison, explicitly coercing you get:
semver_1.lt(semver_1.coerce('0.2.0-1'), minVersion)
false
My assumption is that strings are implicitly coerced when calling comparison functions, perhaps this is incorrect?
Expected Behavior
semver.lt('0.2.0-1', '0.2.0', { includePrerelease: false })
should return false.
Steps To Reproduce
- In node shell
- With the current latest version of semver installed
- Run 'require('semver').lt('0.2.0-1', '0.2.0', { includePrerelease: false })
- Wrong value
true
is returned
Environment
- npm: 6.14.15
- Node: 14.8.1
- OS: Mac Monterey 12.5.1
- platform: Macbook Pro i9