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

Closed
kt3k opened this issue May 23, 2024 · 4 comments · Fixed by #5567
Closed

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

kt3k opened this issue May 23, 2024 · 4 comments · Fixed by #5567
Assignees
Labels
bug Something isn't working PR welcome A pull request for this issue would be welcome 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:
https://github.com/denoland/deno_std/blob/083b63f428bc64cd45dcabda9b62c9d600805582/semver/parse_range_test.ts#L354-L365

@iuioiua
Copy link
Contributor

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.

@iuioiua iuioiua self-assigned this Jun 27, 2024
@kt3k
Copy link
Member Author

kt3k commented Jun 27, 2024

I think parseRange('blerg') should throw

@iuioiua
Copy link
Contributor

iuioiua commented Jun 27, 2024

Clarifying my previous message, I meant changing tests is to be expected. I'm in agreement that parseRange("blerg") should throw.

@iuioiua iuioiua added the PR welcome A pull request for this issue would be welcome label Jun 27, 2024
@iuioiua iuioiua mentioned this issue Jul 22, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working PR welcome A pull request for this issue would be welcome semver
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants