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

Skip setting hash if hash was not set previously #1871

Merged
merged 7 commits into from
Nov 16, 2016
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion __tests__/commands/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ test.concurrent('install with arg', (): Promise<void> => {
return runAdd({}, ['is-online'], 'install-with-arg');
});

test.concurrent('install from github', (): Promise<void> => {
return runAdd({}, ['substack/node-mkdirp#master'], 'install-github');
});

test.concurrent('install with --dev flag', (): Promise<void> => {
return runAdd({dev: true}, ['left-pad@1.1.0'], 'add-with-flag', async (config) => {
const lockfile = explodeLockfile(await fs.readFile(path.join(config.cwd, 'yarn.lock')));
Expand Down Expand Up @@ -571,5 +575,4 @@ test.concurrent('add should generate correct integrity file', (): Promise<void>
}
expect(allCorrect).toBe(true);
});

});
4 changes: 4 additions & 0 deletions __tests__/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ test.concurrent('install from git cache', (): Promise<void> => {
});
});

test.concurrent('install from github', (): Promise<void> => {
return runInstall({}, 'install-github');
});

test.concurrent('install should dedupe dependencies avoiding conflicts 0', (): Promise<void> => {
// A@2.0.1 -> B@2.0.0
// B@1.0.0
Expand Down
10 changes: 1 addition & 9 deletions __tests__/commands/ls.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import Config from '../../src/config.js';

jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000;

const stream = require('stream');
const path = require('path');
const os = require('os');

Expand Down Expand Up @@ -48,14 +47,7 @@ async function runLs(
}
}

let out = '';
const stdout = new stream.Writable({
decodeStrings: false,
write(data, encoding, cb) {
out += data;
cb();
},
});
const out = '';

const reporter = new reporters.BufferReporter({stdout: null, stdin: null});

Expand Down
10 changes: 1 addition & 9 deletions __tests__/commands/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000;

const execCommand: $FlowFixMe = require('../../src/util/execute-lifecycle-script').execCommand;

const stream = require('stream');
const path = require('path');
const os = require('os');

Expand Down Expand Up @@ -40,14 +39,7 @@ async function runRun(
}
}

let out = '';
const stdout = new stream.Writable({
decodeStrings: false,
write(data, encoding, cb) {
out += data;
cb();
},
});
const out = '';

const reporter = new reporters.BufferReporter({stdout: null, stdin: null});

Expand Down
Empty file.
5 changes: 5 additions & 0 deletions __tests__/fixtures/install/install-github/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"mkdirp": "substack/node-mkdirp#master"
}
}
1 change: 1 addition & 0 deletions end_to_end_tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

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.

1 change: 1 addition & 0 deletions end_to_end_tests/data/run-yarn-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

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

and this

4 changes: 1 addition & 3 deletions src/cli/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ import map from '../../util/map.js';
import {sortAlpha} from '../../util/misc.js';

const invariant = require('invariant');
const userHome = require('user-home');
const semver = require('semver');
const emoji = require('node-emoji');
const isCI = require('is-ci');
const path = require('path');
const fs2 = require('fs');

const {version: YARN_VERSION, installationMethod: YARN_INSTALL_METHOD} = require('../../../package.json');
const ONE_DAY = 1000 * 60 * 60 * 24;
Expand Down Expand Up @@ -97,7 +95,7 @@ function getUpdateCommand(): ?string {
}

if (YARN_INSTALL_METHOD === 'chocolatey') {
return 'choco upgrade yarn';
return 'choco upgrade yarn';
}

return null;
Expand Down
6 changes: 5 additions & 1 deletion src/package-fetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
ref.remote.hash = res.hash;
}

if (res.resolved) {
ref.remote.resolved = res.resolved;
}
Expand Down