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

fix: multiple breakages due to jest version upgrade #7667

Merged
merged 8 commits into from
Apr 29, 2020
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"jsii-rosetta": "^1.4.1",
"lerna": "^3.20.2",
"standard-version": "^7.1.0",
"graceful-fs": "^4.2.4",
"typescript": "~3.8.3"
},
"repository": {
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/assert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"devDependencies": {
"@types/jest": "^25.2.1",
"cdk-build-tools": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0",
"ts-jest": "^25.4.0"
},
Expand All @@ -44,7 +44,7 @@
},
"peerDependencies": {
"@aws-cdk/core": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"constructs": "^3.0.2"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-autoscaling-hooktargets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-batch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"jest": "^25.3.0",
"jest": "^25.5.0",
"lambda-tester": "^3.6.0",
"nock": "^11.7.0",
"ts-jest": "^25.3.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cloudwatch-actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-cognito/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"nodeunit": "^0.11.3",
"pkglint": "0.0.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"eslint-plugin-node": "^10.0.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.1",
"jest": "^25.3.0",
"jest": "^25.5.0",
"lambda-tester": "^3.6.0",
"nock": "^11.7.0"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-dynamodb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0",
"sinon": "^9.0.2",
"ts-jest": "^25.4.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ecs-patterns/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"nodeunit": "^0.11.3",
"pkglint": "0.0.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"@aws-cdk/assert": "0.0.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-events-targets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"aws-sdk-mock": "^5.1.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-iam/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-lambda-destinations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-logs-destinations/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-route53-patterns/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-route53-targets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-s3-notifications/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"@aws-cdk/assert": "0.0.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-sam/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@types/jest": "^25.2.1",
"cdk-build-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0",
"ts-jest": "^25.4.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ses-actions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-sns-subscriptions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"cfn2ts": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-stepfunctions-tasks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"@aws-cdk/aws-s3-assets": "0.0.0",
"cdk-build-tools": "0.0.0",
"cdk-integ-tools": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cdk-assets-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"devDependencies": {
"@types/jest": "^25.2.1",
"cdk-build-tools": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cloud-assembly-schema/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"@types/jest": "^25.2.1",
"@types/mock-fs": "^4.10.0",
"cdk-build-tools": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"mock-fs": "^4.12.0",
"pkglint": "0.0.0",
"typescript-json-schema": "^0.42.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cloudformation-diff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@types/table": "^4.0.7",
"cdk-build-tools": "0.0.0",
"fast-check": "^1.24.2",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0",
"ts-jest": "^25.4.0"
},
Expand Down
9 changes: 9 additions & 0 deletions packages/@aws-cdk/core/lib/private/runtime-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ export function collectRuntimeInformation(): cxschema.RuntimeInfo {
*/
function findNpmPackage(fileName: string): { name: string, version: string, private?: boolean } | undefined {
const mod = require.cache[fileName];

if (!mod.paths) {
// sometimes this can be undefined. for example when querying for .json modules
// inside a jest runtime environment.
// see https://github.com/aws/aws-cdk/issues/7657
// potentially we can remove this if it turns out to be a bug in how jest implemented the 'require' module.
return undefined;
}

const paths = mod.paths.map(stripNodeModules);

try {
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/cx-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"@types/mock-fs": "^4.10.0",
"@types/semver": "^7.1.0",
"cdk-build-tools": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"mock-fs": "^4.12.0",
"pkglint": "0.0.0"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/@monocdk-experiment/assert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
"devDependencies": {
"@types/jest": "^25.2.1",
"cdk-build-tools": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0",
"ts-jest": "^25.4.0",
"@monocdk-experiment/rewrite-imports": "0.0.0",
Expand All @@ -56,7 +56,7 @@
"@aws-cdk/cloudformation-diff": "0.0.0"
},
"peerDependencies": {
"jest": "^25.4.0",
"jest": "^25.5.0",
"monocdk-experiment": "^0.0.0",
"constructs": "^3.0.2"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"devDependencies": {
"@aws-cdk/assert": "%cdk-version%",
"aws-cdk": "%cdk-version%",
"jest": "^25.3.0"
"jest": "^25.5.0"
},
"dependencies": {
"@aws-cdk/core": "%cdk-version%"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@aws-cdk/assert": "%cdk-version%",
"@types/jest": "^25.2.1",
"@types/node": "10.17.5",
"jest": "^25.3.0",
"jest": "^25.5.0",
"ts-jest": "^25.3.1",
"aws-cdk": "%cdk-version%",
"ts-node": "^8.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@aws-cdk/assert": "%cdk-version%",
"@types/jest": "^25.2.1",
"@types/node": "10.17.5",
"jest": "^25.3.0",
"jest": "^25.5.0",
"ts-jest": "^25.3.1",
"typescript": "~3.7.2"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"devDependencies": {
"@aws-cdk/assert": "%cdk-version%",
"aws-cdk": "%cdk-version%",
"jest": "^25.3.0"
"jest": "^25.5.0"
},
"dependencies": {
"@aws-cdk/aws-sns": "%cdk-version%",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@aws-cdk/assert": "%cdk-version%",
"@types/jest": "^25.2.1",
"@types/node": "10.17.5",
"jest": "^25.3.0",
"jest": "^25.5.0",
"ts-jest": "^25.3.1",
"ts-node": "^8.1.0",
"typescript": "~3.7.2"
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"@types/yargs": "^15.0.4",
"aws-sdk-mock": "^5.1.0",
"cdk-build-tools": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"mockery": "^2.1.0",
"pkglint": "0.0.0",
"sinon": "^9.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/cdk-assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@types/jszip": "^3.1.7",
"jszip": "^3.4.0",
"cdk-build-tools": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"mock-fs": "^4.12.0",
"pkglint": "0.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/cdk-dasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"devDependencies": {
"@types/jest": "^25.2.1",
"@types/yaml": "1.9.7",
"jest": "^25.4.0"
"jest": "^25.5.0"
},
"keywords": [
"aws",
Expand Down
2 changes: 1 addition & 1 deletion packages/decdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
"@types/jest": "^25.2.1",
"@types/yaml": "1.9.7",
"@types/yargs": "^15.0.4",
"jest": "^25.4.0",
"jest": "^25.5.0",
"jsii": "^1.4.1"
},
"keywords": [
Expand Down
22 changes: 22 additions & 0 deletions packages/decdk/test/sanity.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import * as path from 'path';

test('path.resolve is sane', async () => {
// Reasons why this might not be true:
// graceful-fs, which is used by Jest, hooks into process.cwd() and
// process.chdir() and caches the values. Because... profit?

const targetDir = path.join(__dirname, 'fixture');

const cwd = process.cwd();

try {
process.chdir(targetDir);
expect(process.cwd()).toEqual(targetDir);

const resolved = path.resolve('.');
expect(resolved).toEqual(targetDir);

} finally {
process.chdir(cwd);
}
});
2 changes: 1 addition & 1 deletion tools/cdk-build-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
"eslint-import-resolver-typescript": "^2.0.0",
"eslint-plugin-import": "^2.20.2",
"fs-extra": "^8.1.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"jsii": "^1.4.1",
"jsii-pacmak": "^1.4.1",
"nodeunit": "^0.11.3",
Expand Down
2 changes: 1 addition & 1 deletion tools/cfn2ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"@types/jest": "^25.2.1",
"@types/yargs": "^15.0.4",
"cdk-build-tools": "0.0.0",
"jest": "^25.4.0",
"jest": "^25.5.0",
"pkglint": "0.0.0"
},
"keywords": [
Expand Down
Loading