diff --git a/.circleci/config.yml b/.circleci/config.yml index 73cd559039..bf1c77d8fd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -130,7 +130,7 @@ jobs: test-pkg-tests-linux-node12: <<: *docker_defaults docker: - - image: node:12 + - image: node:12.18.2 <<: *pkg_tests test-pkg-tests-linux-node10: <<: *docker_defaults diff --git a/__tests__/commands/_helpers.js b/__tests__/commands/_helpers.js index a216a477dd..8454f65b43 100644 --- a/__tests__/commands/_helpers.js +++ b/__tests__/commands/_helpers.js @@ -98,6 +98,7 @@ export function makeConfigFromDirectory(cwd: string, reporter: Reporter, flags: enableDefaultRc: !flags.noDefaultRc, extraneousYarnrcFiles: flags.useYarnrc, modulesFolder: flags.modulesFolder ? path.join(cwd, flags.modulesFolder) : undefined, + packageDateLimit: flags.packageDateLimit, }, reporter, ); diff --git a/__tests__/commands/info.js b/__tests__/commands/info.js index fc570ff434..0c90deff4b 100644 --- a/__tests__/commands/info.js +++ b/__tests__/commands/info.js @@ -44,7 +44,7 @@ const expectedKeys = [ ]; // yarn now ships as built, single JS files so it has no dependencies and no scripts -const unexpectedKeys = ['dependencies', 'devDependencies', 'scripts']; +const unexpectedKeys = ['dependencies', 'devDependencies']; // 'scripts' removed from v1.23 beforeEach(() => { // the mocked requests have stripped metadata, don't use it in the following tests diff --git a/__tests__/commands/install/package-date-limit.js b/__tests__/commands/install/package-date-limit.js new file mode 100644 index 0000000000..a495f69e2f --- /dev/null +++ b/__tests__/commands/install/package-date-limit.js @@ -0,0 +1,17 @@ +/* @flow */ + +import {getPackageVersion, runInstall} from '../_helpers.js'; + +jasmine.DEFAULT_TIMEOUT_INTERVAL = 120000; + +test.concurrent('installing with --package-date-limit should install the specified version of a package', () => { + return runInstall({packageDateLimit: '2018-05-01T00:00:00.000Z'}, 'install-by-package-date-limit', async config => { + expect(await getPackageVersion(config, 'trough')).toEqual('1.0.2'); + }); +}); + +test.concurrent('installing without --package-date-limit should install the latest version of a package', () => { + return runInstall({}, 'install-by-package-date-limit', async config => { + expect(await getPackageVersion(config, 'trough')).toEqual('1.0.4'); + }); +}); diff --git a/__tests__/fixtures/install/install-by-package-date-limit/package.json b/__tests__/fixtures/install/install-by-package-date-limit/package.json new file mode 100644 index 0000000000..cb85fa833b --- /dev/null +++ b/__tests__/fixtures/install/install-by-package-date-limit/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "trough": ">1.0.0 <1.0.5" + } +} diff --git a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/trough.bin b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/trough.bin new file mode 100644 index 0000000000..4fe98ab0c3 Binary files /dev/null and b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/trough.bin differ diff --git a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/trough/-/trough-1.0.2.tgz.bin b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/trough/-/trough-1.0.2.tgz.bin new file mode 100644 index 0000000000..3ed27022ec Binary files /dev/null and b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/trough/-/trough-1.0.2.tgz.bin differ diff --git a/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/trough/-/trough-1.0.4.tgz.bin b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/trough/-/trough-1.0.4.tgz.bin new file mode 100644 index 0000000000..5152da51ec Binary files /dev/null and b/__tests__/fixtures/request-cache/GET/registry.yarnpkg.com/trough/-/trough-1.0.4.tgz.bin differ diff --git a/__tests__/index.js b/__tests__/index.js index 425e8acb76..ed4e07da88 100644 --- a/__tests__/index.js +++ b/__tests__/index.js @@ -16,7 +16,7 @@ const semver = require('semver'); let ver = process.versions.node; ver = ver.split('-')[0]; -jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000; +jasmine.DEFAULT_TIMEOUT_INTERVAL = 90000; if (!existsSync(path.resolve(__dirname, '../lib'))) { throw new Error('These tests require `yarn build` to have been run first.'); diff --git a/__tests__/integration.js b/__tests__/integration.js index eda727e896..28fb5a925f 100644 --- a/__tests__/integration.js +++ b/__tests__/integration.js @@ -70,7 +70,11 @@ addTest('https://github.com/bestander/chrome-app-livereload.git'); // no package addTest('bestander/chrome-app-livereload'); // no package.json, github, tarball if (process.platform !== 'win32') { - addTest('https://github.com/yarnpkg/yarn/releases/download/v0.18.1/yarn-v0.18.1.tar.gz'); // tarball + addTest( + 'https://github.com/yarnpkg/yarn/releases/download/v0.18.1/yarn-v0.18.1.tar.gz', // tarball + {strictPeers: false}, + ['--no-node-version-check', '--ignore-engines'], + ); addTest('react-scripts@1.0.13', {strictPeers: true}, ['--no-node-version-check', '--ignore-engines']); // many peer dependencies, there shouldn't be any peerDep warnings } diff --git a/packages/pkg-tests/package.json b/packages/pkg-tests/package.json index 2b7e1fa77a..1f7e3396bd 100644 --- a/packages/pkg-tests/package.json +++ b/packages/pkg-tests/package.json @@ -27,6 +27,9 @@ "jest": { "modulePathIgnorePatterns": [ "/pkg-tests-fixtures/packages/" + ], + "transformIgnorePatterns": [ + "/node_modules/(?!pkg-tests-)" ] } } diff --git a/packages/pkg-tests/pkg-tests-specs/sources/pnp.js b/packages/pkg-tests/pkg-tests-specs/sources/pnp.js index a4ed85795d..e7317a0e62 100644 --- a/packages/pkg-tests/pkg-tests-specs/sources/pnp.js +++ b/packages/pkg-tests/pkg-tests-specs/sources/pnp.js @@ -1438,7 +1438,7 @@ module.exports = makeTemporaryEnv => { makeTemporaryEnv( { dependencies: { - [`resolve`]: `https://github.com/browserify/resolve.git`, + [`resolve`]: `https://github.com/browserify/resolve.git#v1.16.1`, }, resolutions: { [`path-parse`]: `https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz`, diff --git a/src/cli/commands/config.js b/src/cli/commands/config.js index d884c2c39e..d0eff3c6cf 100644 --- a/src/cli/commands/config.js +++ b/src/cli/commands/config.js @@ -38,6 +38,7 @@ const CONFIG_KEYS = [ 'cacheFolder', 'tempFolder', 'production', + 'packageDateLimit', ]; export function hasWrapper(flags: Object, args: Array): boolean { diff --git a/src/cli/index.js b/src/cli/index.js index a7937a317a..9b8137aaae 100644 --- a/src/cli/index.js +++ b/src/cli/index.js @@ -135,6 +135,7 @@ export async function main({ commander.option('--no-node-version-check', 'do not warn when using a potentially unsupported Node version'); commander.option('--focus', 'Focus on a single workspace by installing remote copies of its sibling workspaces.'); commander.option('--otp ', 'one-time password for two factor authentication'); + commander.option('--package-date-limit