Skip to content

Unexpected results comparing with SemVersion.Satisfies #82

Closed
@devklick

Description

@devklick

I'm expecting version 1.2.3-alpha to satisfy the range < 1.2.4, but that doesn't seem to be the case.

I'm not sure if the < part of this is specific to npm or part of the underlying semver spec, but both of the following return false.

SemVersion.Parse("1.2.3-alpha").SatisfiesNpm("< 1.2.4"); // false
SemVersion.Parse("1.2.3-alpha").Satisfies(SemVersionRange.Parse("< 1.2.4")); // false

The only thing I can to make this work is use SatisfiesNpm and pass in includeAllPrerelease: true. IMO this shouldn't be necessary; regardless of the pre-release flag, 1.2.3 is definitely less than 1.2.4.

SemVersion.Parse("1.2.3-alpha").SatisfiesNpm("< 1.2.4", includeAllPrerelease: true); // true

Is this functioning as intended? I've read the description for this parameter a couple of times and I'm still struggling to get my head around exactly what it's intended to do:

includeAllPrerelease:
Whether to include all prerelease versions satisfying the bounds in the range
or to only include prerelease versions when it matches a bound that explicitly
includes prerelease versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions