Skip to content

feat: preserve pre-release and build parts of a version on coerce (#592) #671

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

Merged
merged 12 commits into from
Jan 31, 2024
Prev Previous commit
Next Next commit
Increase version comparison readability
  • Loading branch information
madtisa committed Jan 4, 2024
commit e3cecc0a29be84b881bba53d147f6e7a46116c74
6 changes: 3 additions & 3 deletions test/functions/coerce.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ test('coerce tests', (t) => {
const coerceExpression = `coerce(${input}, ${JSON.stringify(options)})`
const coercedVersion = coerce(input, options) || {}
const expectedVersion = parse(expected)
t.equal(
expectedVersion.compare(coercedVersion) || expectedVersion.compareBuild(coercedVersion),
0,
t.ok(
expectedVersion.compare(coercedVersion) === 0 &&
expectedVersion.compareBuild(coercedVersion) === 0,
`${coerceExpression} should be equal to ${expectedVersion}`
)
})
Expand Down