Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Commit

Permalink
chore(yarn-cling): rename test packages to real package names (aws#16325
Browse files Browse the repository at this point in the history
)

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*
  • Loading branch information
njlynch authored and madeline-k committed Sep 2, 2021
1 parent 7ffd505 commit 26ce502
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 42 deletions.
4 changes: 2 additions & 2 deletions tools/yarn-cling/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ dist
coverage
nyc.config.js
!.eslintrc.js
!test/test-fixture/package1/node_modules/
junit.xml
!test/test-fixture/jsii/node_modules/
junit.xml
2 changes: 1 addition & 1 deletion tools/yarn-cling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
32 changes: 16 additions & 16 deletions tools/yarn-cling/test/cling.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,30 @@ 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',
},
},
integrity: 'sha512-banana',
requires: {
registrydependency2: '^2.3.4',
'aws-cdk-lib': '^2.3.4',
},
resolved: 'https://registry.bla.com/stuff',
version: '1.2.999',
Expand All @@ -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',
Expand All @@ -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',
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name": "package2",
"name": "cdk",
"version": "2.2.2"
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tools/yarn-cling/test/test-fixture/jsii/node_modules/cdk

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions tools/yarn-cling/test/test-fixture/jsii/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "jsii",
"version": "1.1.1",
"dependencies": {
"aws-cdk": "^1.2.3",
"cdk": "2.2.2"
}
}

This file was deleted.

This file was deleted.

This file was deleted.

8 changes: 0 additions & 8 deletions tools/yarn-cling/test/test-fixture/package1/package.json

This file was deleted.

4 changes: 2 additions & 2 deletions tools/yarn-cling/test/test-fixture/yarn.lock
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 26ce502

Please sign in to comment.