Skip to content

Conversation

@mldangelo
Copy link

Summary

The --loose flag was not being applied when validating input versions.

Problem

$ semver 1.2.3beta -l
# Expected: 1.2.3-beta (exit 0)
# Actual: exit 1

The options object (containing loose: true) was already being passed to coerce() and satisfies(), but the filter() validation step was calling semver.valid(v) without it.

Fix

-  return semver.valid(v)
+  return semver.valid(v, options)

Test plan

  • Added regression test for 1.2.3beta -l
  • All existing tests pass
  • 100% code coverage maintained

@mldangelo mldangelo requested a review from a team as a code owner December 20, 2025 08:08
The `--loose` flag was not being applied when validating input versions.
The `options` object was already computed and passed to `coerce()` and
`satisfies()`, but the `filter()` call using `semver.valid(v)` was missing
the options parameter.

This meant that loose versions like `1.2.3beta` would fail validation
even when `-l` was specified, despite the documentation stating that
`-l --loose` will "Interpret versions and ranges loosely".
@mldangelo mldangelo force-pushed the fix/cli-loose-validation branch from b4fa6e7 to 643da59 Compare December 20, 2025 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant