From 26ce50270de43c8105ba4ad7064e3d86b9c3d1b7 Mon Sep 17 00:00:00 2001 From: Nick Lynch Date: Wed, 1 Sep 2021 19:20:28 +0100 Subject: [PATCH] chore(yarn-cling): rename test packages to real package names (#16325) The tests for `yarn-cling` currently reference what were imaginary package names as placeholders; those package names have now been registered. While this has no practical impact, switching the package names to be ones we own just so there's no ambiguity. An `npm install` is never done on these directories, so the packages chosen really doesn't matter. Just picked two of our favorites at random. :) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- tools/yarn-cling/.gitignore | 4 +-- tools/yarn-cling/package.json | 2 +- tools/yarn-cling/test/cling.test.ts | 32 +++++++++---------- .../{package2 => cdk}/package.json | 2 +- .../node_modules/aws-cdk-lib/package.json | 4 +++ .../jsii/node_modules/aws-cdk/package.json | 7 ++++ .../test/test-fixture/jsii/node_modules/cdk | 1 + .../test/test-fixture/jsii/package.json | 8 +++++ .../package1/node_modules/package2 | 1 - .../registrydependency1/package.json | 7 ---- .../registrydependency2/package.json | 4 --- .../test/test-fixture/package1/package.json | 8 ----- tools/yarn-cling/test/test-fixture/yarn.lock | 4 +-- 13 files changed, 42 insertions(+), 42 deletions(-) rename tools/yarn-cling/test/test-fixture/{package2 => cdk}/package.json (52%) create mode 100644 tools/yarn-cling/test/test-fixture/jsii/node_modules/aws-cdk-lib/package.json create mode 100644 tools/yarn-cling/test/test-fixture/jsii/node_modules/aws-cdk/package.json create mode 120000 tools/yarn-cling/test/test-fixture/jsii/node_modules/cdk create mode 100644 tools/yarn-cling/test/test-fixture/jsii/package.json delete mode 120000 tools/yarn-cling/test/test-fixture/package1/node_modules/package2 delete mode 100644 tools/yarn-cling/test/test-fixture/package1/node_modules/registrydependency1/package.json delete mode 100644 tools/yarn-cling/test/test-fixture/package1/node_modules/registrydependency2/package.json delete mode 100644 tools/yarn-cling/test/test-fixture/package1/package.json diff --git a/tools/yarn-cling/.gitignore b/tools/yarn-cling/.gitignore index 884f5381e01ab..bef31def37928 100644 --- a/tools/yarn-cling/.gitignore +++ b/tools/yarn-cling/.gitignore @@ -11,5 +11,5 @@ dist coverage nyc.config.js !.eslintrc.js -!test/test-fixture/package1/node_modules/ -junit.xml \ No newline at end of file +!test/test-fixture/jsii/node_modules/ +junit.xml diff --git a/tools/yarn-cling/package.json b/tools/yarn-cling/package.json index 52501bf50f83e..9d86cc671b4d4 100644 --- a/tools/yarn-cling/package.json +++ b/tools/yarn-cling/package.json @@ -16,7 +16,7 @@ "build": "tsc", "watch": "tsc -w", "pkglint": "pkglint -f", - "test": "ln -sf ../../package2 test/test-fixture/package1/node_modules/ && jest", + "test": "ln -sf ../../cdk test/test-fixture/jsii/node_modules/ && jest", "build+test+package": "yarn build+test", "build+test": "yarn build && yarn test", "build+extract": "yarn build", diff --git a/tools/yarn-cling/test/cling.test.ts b/tools/yarn-cling/test/cling.test.ts index 1628d2415a1ae..f56e98f535f91 100644 --- a/tools/yarn-cling/test/cling.test.ts +++ b/tools/yarn-cling/test/cling.test.ts @@ -3,22 +3,22 @@ import { checkRequiredVersions, generateShrinkwrap } from '../lib'; test('generate lock for fixture directory', async () => { const lockFile = await generateShrinkwrap({ - packageJsonFile: path.join(__dirname, 'test-fixture', 'package1', 'package.json'), + packageJsonFile: path.join(__dirname, 'test-fixture', 'jsii', 'package.json'), hoist: false, }); expect(lockFile).toEqual({ lockfileVersion: 1, - name: 'package1', + name: 'jsii', requires: true, version: '1.1.1', dependencies: { - package2: { + 'cdk': { version: '2.2.2', }, - registrydependency1: { + 'aws-cdk': { dependencies: { - registrydependency2: { + 'aws-cdk-lib': { integrity: 'sha512-pineapple', resolved: 'https://registry.bla.com/stuff', version: '2.3.999', @@ -26,7 +26,7 @@ test('generate lock for fixture directory', async () => { }, integrity: 'sha512-banana', requires: { - registrydependency2: '^2.3.4', + 'aws-cdk-lib': '^2.3.4', }, resolved: 'https://registry.bla.com/stuff', version: '1.2.999', @@ -37,28 +37,28 @@ test('generate lock for fixture directory', async () => { test('generate hoisted lock for fixture directory', async () => { const lockFile = await generateShrinkwrap({ - packageJsonFile: path.join(__dirname, 'test-fixture', 'package1', 'package.json'), + packageJsonFile: path.join(__dirname, 'test-fixture', 'jsii', 'package.json'), hoist: true, }); expect(lockFile).toEqual({ lockfileVersion: 1, - name: 'package1', + name: 'jsii', requires: true, version: '1.1.1', dependencies: { - package2: { + 'cdk': { version: '2.2.2', }, - registrydependency1: { + 'aws-cdk': { integrity: 'sha512-banana', requires: { - registrydependency2: '^2.3.4', + 'aws-cdk-lib': '^2.3.4', }, resolved: 'https://registry.bla.com/stuff', version: '1.2.999', }, - registrydependency2: { + 'aws-cdk-lib': { integrity: 'sha512-pineapple', resolved: 'https://registry.bla.com/stuff', version: '2.3.999', @@ -70,17 +70,17 @@ test('generate hoisted lock for fixture directory', async () => { test('fail when requires cannot be satisfied', async () => { const lockFile = { lockfileVersion: 1, - name: 'package1', + name: 'jsii', requires: true, version: '1.1.1', dependencies: { - package1: { + jsii: { version: '2.2.2', requires: { - package2: '^3.3.3', // <- this needs to be adjusted + cdk: '^3.3.3', // <- this needs to be adjusted }, }, - package2: { + cdk: { version: '4.4.4', }, }, diff --git a/tools/yarn-cling/test/test-fixture/package2/package.json b/tools/yarn-cling/test/test-fixture/cdk/package.json similarity index 52% rename from tools/yarn-cling/test/test-fixture/package2/package.json rename to tools/yarn-cling/test/test-fixture/cdk/package.json index d10f139d13944..8594e124f71b7 100644 --- a/tools/yarn-cling/test/test-fixture/package2/package.json +++ b/tools/yarn-cling/test/test-fixture/cdk/package.json @@ -1,4 +1,4 @@ { - "name": "package2", + "name": "cdk", "version": "2.2.2" } diff --git a/tools/yarn-cling/test/test-fixture/jsii/node_modules/aws-cdk-lib/package.json b/tools/yarn-cling/test/test-fixture/jsii/node_modules/aws-cdk-lib/package.json new file mode 100644 index 0000000000000..2721d93a758df --- /dev/null +++ b/tools/yarn-cling/test/test-fixture/jsii/node_modules/aws-cdk-lib/package.json @@ -0,0 +1,4 @@ +{ + "name": "aws-cdk-lib", + "version": "2.3.999" +} diff --git a/tools/yarn-cling/test/test-fixture/jsii/node_modules/aws-cdk/package.json b/tools/yarn-cling/test/test-fixture/jsii/node_modules/aws-cdk/package.json new file mode 100644 index 0000000000000..f074216bccb3b --- /dev/null +++ b/tools/yarn-cling/test/test-fixture/jsii/node_modules/aws-cdk/package.json @@ -0,0 +1,7 @@ +{ + "name": "aws-cdk", + "version": "1.2.999", + "dependencies": { + "aws-cdk-lib": "^2.3.4" + } +} diff --git a/tools/yarn-cling/test/test-fixture/jsii/node_modules/cdk b/tools/yarn-cling/test/test-fixture/jsii/node_modules/cdk new file mode 120000 index 0000000000000..7ce3fadc4aadf --- /dev/null +++ b/tools/yarn-cling/test/test-fixture/jsii/node_modules/cdk @@ -0,0 +1 @@ +../../cdk \ No newline at end of file diff --git a/tools/yarn-cling/test/test-fixture/jsii/package.json b/tools/yarn-cling/test/test-fixture/jsii/package.json new file mode 100644 index 0000000000000..8508d1f52fc9e --- /dev/null +++ b/tools/yarn-cling/test/test-fixture/jsii/package.json @@ -0,0 +1,8 @@ +{ + "name": "jsii", + "version": "1.1.1", + "dependencies": { + "aws-cdk": "^1.2.3", + "cdk": "2.2.2" + } +} diff --git a/tools/yarn-cling/test/test-fixture/package1/node_modules/package2 b/tools/yarn-cling/test/test-fixture/package1/node_modules/package2 deleted file mode 120000 index 8db12e196dfbd..0000000000000 --- a/tools/yarn-cling/test/test-fixture/package1/node_modules/package2 +++ /dev/null @@ -1 +0,0 @@ -../../package2 \ No newline at end of file diff --git a/tools/yarn-cling/test/test-fixture/package1/node_modules/registrydependency1/package.json b/tools/yarn-cling/test/test-fixture/package1/node_modules/registrydependency1/package.json deleted file mode 100644 index 8ecbc5b50e2e6..0000000000000 --- a/tools/yarn-cling/test/test-fixture/package1/node_modules/registrydependency1/package.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "name": "registrydependency1", - "version": "1.2.999", - "dependencies": { - "registrydependency2": "^2.3.4" - } -} diff --git a/tools/yarn-cling/test/test-fixture/package1/node_modules/registrydependency2/package.json b/tools/yarn-cling/test/test-fixture/package1/node_modules/registrydependency2/package.json deleted file mode 100644 index 8b9d7f39ababd..0000000000000 --- a/tools/yarn-cling/test/test-fixture/package1/node_modules/registrydependency2/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "registrydependency2", - "version": "2.3.999" -} diff --git a/tools/yarn-cling/test/test-fixture/package1/package.json b/tools/yarn-cling/test/test-fixture/package1/package.json deleted file mode 100644 index 8edf6d46e6537..0000000000000 --- a/tools/yarn-cling/test/test-fixture/package1/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "package1", - "version": "1.1.1", - "dependencies": { - "registrydependency1": "^1.2.3", - "package2": "2.2.2" - } -} diff --git a/tools/yarn-cling/test/test-fixture/yarn.lock b/tools/yarn-cling/test/test-fixture/yarn.lock index fda733502a052..bb94543e94422 100644 --- a/tools/yarn-cling/test/test-fixture/yarn.lock +++ b/tools/yarn-cling/test/test-fixture/yarn.lock @@ -1,9 +1,9 @@ -"registrydependency1@^1.2.3": +"aws-cdk@^1.2.3": version "1.2.999" resolved "https://registry.bla.com/stuff" integrity sha512-banana -"registrydependency2@^2.3.4": +"aws-cdk-lib@^2.3.4": version "2.3.999" resolved "https://registry.bla.com/stuff" integrity sha512-pineapple