Skip to content
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

semver: parseRange doesn't throw with invalid input #4845

Open
kt3k opened this issue May 23, 2024 · 2 comments
Open

semver: parseRange doesn't throw with invalid input #4845

kt3k opened this issue May 23, 2024 · 2 comments
Labels
bug Something isn't working semver

Comments

@kt3k
Copy link
Member

kt3k commented May 23, 2024

The below example doesn't throw a type error:

import { parseRange } from "@std/semver";
const range = parseRange("invalid");
console.log(range);

Instead it prints the below range object:

[
  [
    {
      operator: "<",
      major: 0,
      minor: 0,
      patch: 0,
      prerelease: [],
      build: []
    }
  ]
]
@kt3k kt3k added bug Something isn't working semver labels May 23, 2024
@JakeAve
Copy link
Contributor

JakeAve commented May 27, 2024

I've been looking at this and we can update it, but it makes another test case fail. How does this relate to the test case on:

["blerg", [
[
{
operator: "<",
major: 0,
minor: 0,
patch: 0,
prerelease: [],
build: [],
},
],
]],

@iuioiua
Copy link
Collaborator

iuioiua commented May 27, 2024

Yes, that's expected. We'd have to tweak the parseRange() parse ranges of different kinds test to recognize thrown errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working semver
Projects
None yet
Development

No branches or pull requests

3 participants