-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] semver.lt returns wrong value for pre-release version comparison #483
Open
1 task done
Tracked by
#501
Labels
Bug
thing that needs fixing
Comments
IainSAP
changed the title
[BUG] <title>
[BUG] semver.lt returns wrong value for pre-release version comparison
Sep 22, 2022
This is similar to #345, and I think the fix might even be the same for both. |
The comparison functions do not use the Maybe the docs could be improved since it's suggesting that all functions use evaluate all options: Lines 402 to 414 in 868d4bb
|
Stop
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Marc Bernard ***@***.***>
Sent: Tuesday, January 21, 2025 3:22:14 PM
To: npm/node-semver ***@***.***>
Cc: Subscribed ***@***.***>
Subject: Re: [npm/node-semver] [BUG] semver.lt returns wrong value for pre-release version comparison (Issue #483)
The comparison<https://github.com/npm/node-semver/blob/868d4bbe3d318c52544f38d5f9977a1103e924c2/classes/semver.js#L91> functions do not use the includePrerelease option! If major.minor.patch are the same, they always compare the pre-release parts.
Maybe the docs could be improved since it's suggesting that all functions use evaluate all options:
https://github.com/npm/node-semver/blob/868d4bbe3d318c52544f38d5f9977a1103e924c2/README.md?plain=1#L402-L414
—
Reply to this email directly, view it on GitHub<#483 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BD3O5J3DEAXS656T3LK6FGD2L23ANAVCNFSM6AAAAABVTOQFJWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMBVG43DINZVGI>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is there an existing issue for this?
Current Behavior
Using
semver.lt()
returns the incorrect value when comparing pre-release version withincludePrerelease
set to false (or the default).By comparison, explicitly coercing you get:
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
true
is returnedEnvironment
The text was updated successfully, but these errors were encountered: