-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Skip setting hash if hash was not set previously #1871
Conversation
I would appreciate a unit test here. |
Can this be done with the jest test? |
I will add unit tests now :) Then we can hopefully merge it very soon |
Thanks, @thomaschaaf, I'll be ready to merge it at once. |
@@ -88,7 +88,11 @@ export default class PackageFetcher { | |||
newPkg = res.package; | |||
|
|||
// update with new remote | |||
ref.remote.hash = res.hash; | |||
// but only if there was a hash previously as the tarball fetcher does not provide a hash. | |||
if(ref.remote.hash) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor nit to add a space here, if(
-> if (
.
.tgz files got corrupted |
I don't know if this is the correct way to write jest tests as this makes a real http request to github and downloads the files but I did test the unit tests and when I reverted the change the unit tests failed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks a lot @thomaschaaf!
Let's just remove it from e2e scenario and I'll merge it
@@ -3,3 +3,4 @@ This directory contains end-to-end tests for Yarn. The tests perform the followi | |||
1. Spin up a fresh Docker container | |||
2. Install Yarn through the package repository | |||
3. Run `yarn add react` in a test directory | |||
4. Run `yarn add 'substack/node-mkdirp#master'` in a test directory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's remove this now that it is covered with unit test.
@@ -17,3 +17,4 @@ mkdir yarntest | |||
cd yarntest | |||
echo {} > package.json | |||
yarn add react || fail_with_log | |||
yarn add 'substack/node-mkdirp#master' || fail_with_log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this
Should there be some assertions in the unit test to ensure the module installed in the |
Yes, ideally there should be assertations. |
Does the test fail without the fix, @thomaschaaf ? |
@bestander yes the tests fail if it is not fixed |
I'll do 0.17.3 in 30 min |
Thanks for the iterations @thomaschaaf! |
thanks for the quick fix everyone! :) |
* Skip setting hash if hash was not set previously * Add end to end test for installing a github package * Update README.md * Fix eslint * Reverse accidental fixture changes * Add unit tests * No end to end tests for github installs Conflicts: src/cli/commands/install.js
This reverts commit ca6a3d2.
* Skip setting hash if hash was not set previously * Add end to end test for installing a github package * Update README.md * Fix eslint * Reverse accidental fixture changes * Add unit tests * No end to end tests for github installs Conflicts: src/cli/commands/install.js
Summary
This should fix #1834 where yarn had resolved the hosted-git-packages without a hash and downloaded them to the cache folder
<Packagename>-<Version>
. The tarball fetcher would then add the hash after the download completed resulting in the linker believing that the Package could be found in the cache folder<Packagename>-<Version>-<Hash>
.This ba5a203 commit seems to have added the logic behind tarball hashes.
Test plan
I added end to end tests and some jest tests
yarn add mulesoft/api-console.git#master would not work. Now works.