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

(WIP) yarn exits with an error when a dependency has no latest tag #6017

Closed
wants to merge 1 commit into from
Closed

(WIP) yarn exits with an error when a dependency has no latest tag #6017

wants to merge 1 commit into from

Conversation

kpbl
Copy link

@kpbl kpbl commented Jun 21, 2018

Summary
When a dependency package has no latest tag the commands yarn upgrade and yarn upgrade-interactive will throw the following error:
An unexpected error occurred: "Invalid Version: undefined".

This is because in method getOutdatedPackages of the class PackageRequest latest is undefined when no latest tag is found and the call to semver.lt(current, latest) throws an error.

I simply checked if latest is undefined before the call to semver.lt(current, latest) .

fixes #5955

Test plan
I did not know how to write a test for this because i have found no public package that did not has a latest tag. Any advice would be great.

@arcanis
Copy link
Member

arcanis commented Jun 26, 2018

I did not know how to write a test for this because i have found no public package that did not has a latest tag.

How did it happen? Private registry?

Also, I think the fix would rather be the following (to avoid so that if there is no latest, then the dependency isn't marked as out of date rather than the opposite). What do you think?

const isDepOld = ({current, latest, wanted}) =>
      latest === 'exotic' || (semver.lt(current, wanted) || latest === undefined && semver.lt(current, latest));

Copy link
Member

@arcanis arcanis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cf comment

@arcanis
Copy link
Member

arcanis commented Oct 2, 2018

Fixed with #6454

@arcanis arcanis closed this Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants