Skip to content

Commit

Permalink
chore: unify the Jest configuration for all modules
Browse files Browse the repository at this point in the history
Change the mechanism so that each package has its own `jest.config.js` file that requires the centralized file containing our defaults, and can change any of them as needed. Add appropriate `pkglint` rules to make sure this is done for all packages using Jest.
  • Loading branch information
skinny85 authored May 12, 2020
1 parent 30d751d commit 52ce67b
Show file tree
Hide file tree
Showing 444 changed files with 866 additions and 1,669 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,3 @@ cdk.out/

# Yarn error log
yarn-error.log

# Generated jest config
jest.config.gen.json
1 change: 1 addition & 0 deletions packages/@aws-cdk/alexa-ask/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ coverage
dist
tsconfig.json
!.eslintrc.js
!jest.config.js
1 change: 1 addition & 0 deletions packages/@aws-cdk/alexa-ask/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ dist

tsconfig.json
.eslintrc.js
jest.config.js
2 changes: 2 additions & 0 deletions packages/@aws-cdk/alexa-ask/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const baseConfig = require('../../../tools/cdk-build-tools/config/jest.config');
module.exports = baseConfig;
20 changes: 2 additions & 18 deletions packages/@aws-cdk/alexa-ask/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"compat": "cdk-compat"
},
"cdk-build": {
"cloudformation": "Alexa::ASK"
"cloudformation": "Alexa::ASK",
"jest": true
},
"keywords": [
"aws",
Expand All @@ -61,23 +62,6 @@
"url": "https://aws.amazon.com",
"organization": true
},
"jest": {
"moduleFileExtensions": [
"js"
],
"coverageThreshold": {
"global": {
"branches": 60,
"statements": 80
}
},
"collectCoverage": true,
"coverageReporters": [
"lcov",
"html",
"text-summary"
]
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/assert/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ nyc.config.js
.LAST_PACKAGE
*.snk
!.eslintrc.js
!jest.config.js
1 change: 1 addition & 0 deletions packages/@aws-cdk/assert/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ dist

tsconfig.json
.eslintrc.js
jest.config.js
10 changes: 10 additions & 0 deletions packages/@aws-cdk/assert/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const baseConfig = require('../../../tools/cdk-build-tools/config/jest.config');
module.exports = {
...baseConfig,
coverageThreshold: {
global: {
statements: 75,
branches: 65,
},
},
};
13 changes: 4 additions & 9 deletions packages/@aws-cdk/assert/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@
"build+test+package": "npm run build+test && npm run package",
"build+test": "npm run build && npm test"
},
"jest": {
"coverageThreshold": {
"global": {
"statements": 75,
"branches": 65
}
}
},
"author": {
"name": "Amazon Web Services",
"url": "https://aws.amazon.com",
Expand Down Expand Up @@ -61,5 +53,8 @@
"node": ">= 10.13.0"
},
"stability": "experimental",
"maturity": "experimental"
"maturity": "experimental",
"cdk-build": {
"jest": true
}
}
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-accessanalyzer/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ coverage
dist
tsconfig.json
!.eslintrc.js
!jest.config.js
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-accessanalyzer/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ dist
tsconfig.json
!.jsii
.eslintrc.js
jest.config.js
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-accessanalyzer/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const baseConfig = require('../../../tools/cdk-build-tools/config/jest.config');
module.exports = baseConfig;
20 changes: 2 additions & 18 deletions packages/@aws-cdk/aws-accessanalyzer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"build+test+package": "npm run build+test && npm run package"
},
"cdk-build": {
"cloudformation": "AWS::AccessAnalyzer"
"cloudformation": "AWS::AccessAnalyzer",
"jest": true
},
"keywords": [
"aws",
Expand All @@ -62,23 +63,6 @@
"url": "https://aws.amazon.com",
"organization": true
},
"jest": {
"moduleFileExtensions": [
"js"
],
"coverageThreshold": {
"global": {
"branches": 60,
"statements": 80
}
},
"collectCoverage": true,
"coverageReporters": [
"lcov",
"html",
"text-summary"
]
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-acmpca/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ coverage
.LAST_PACKAGE
*.snk
!.eslintrc.js
!jest.config.js
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-acmpca/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ dist
tsconfig.json

.eslintrc.js
jest.config.js
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-acmpca/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const baseConfig = require('../../../tools/cdk-build-tools/config/jest.config');
module.exports = baseConfig;
20 changes: 2 additions & 18 deletions packages/@aws-cdk/aws-acmpca/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"compat": "cdk-compat"
},
"cdk-build": {
"cloudformation": "AWS::ACMPCA"
"cloudformation": "AWS::ACMPCA",
"jest": true
},
"keywords": [
"aws",
Expand All @@ -62,23 +63,6 @@
"url": "https://aws.amazon.com",
"organization": true
},
"jest": {
"moduleFileExtensions": [
"js"
],
"coverageThreshold": {
"global": {
"branches": 60,
"statements": 80
}
},
"collectCoverage": true,
"coverageReporters": [
"lcov",
"html",
"text-summary"
]
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-amazonmq/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ tsconfig.json

*.snk
!.eslintrc.js
!jest.config.js
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-amazonmq/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ dist

tsconfig.json
.eslintrc.js
jest.config.js
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-amazonmq/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const baseConfig = require('../../../tools/cdk-build-tools/config/jest.config');
module.exports = baseConfig;
20 changes: 2 additions & 18 deletions packages/@aws-cdk/aws-amazonmq/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"compat": "cdk-compat"
},
"cdk-build": {
"cloudformation": "AWS::AmazonMQ"
"cloudformation": "AWS::AmazonMQ",
"jest": true
},
"keywords": [
"aws",
Expand All @@ -61,23 +62,6 @@
"url": "https://aws.amazon.com",
"organization": true
},
"jest": {
"moduleFileExtensions": [
"js"
],
"coverageThreshold": {
"global": {
"branches": 60,
"statements": 80
}
},
"collectCoverage": true,
"coverageReporters": [
"lcov",
"html",
"text-summary"
]
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-amplify/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ coverage
dist
tsconfig.json
!.eslintrc.js
!jest.config.js
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-amplify/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ dist

tsconfig.json
.eslintrc.js
jest.config.js
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-amplify/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const baseConfig = require('../../../tools/cdk-build-tools/config/jest.config');
module.exports = baseConfig;
20 changes: 2 additions & 18 deletions packages/@aws-cdk/aws-amplify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"compat": "cdk-compat"
},
"cdk-build": {
"cloudformation": "AWS::Amplify"
"cloudformation": "AWS::Amplify",
"jest": true
},
"keywords": [
"aws",
Expand All @@ -62,23 +63,6 @@
"url": "https://aws.amazon.com",
"organization": true
},
"jest": {
"moduleFileExtensions": [
"js"
],
"coverageThreshold": {
"global": {
"branches": 70,
"statements": 80
}
},
"collectCoverage": true,
"coverageReporters": [
"lcov",
"html",
"text-summary"
]
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-apigatewayv2/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ coverage
dist
tsconfig.json
!.eslintrc.js
!jest.config.js
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-apigatewayv2/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ dist
tsconfig.json
!.jsii
.eslintrc.js
jest.config.js
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-apigatewayv2/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const baseConfig = require('../../../tools/cdk-build-tools/config/jest.config');
module.exports = baseConfig;
20 changes: 2 additions & 18 deletions packages/@aws-cdk/aws-apigatewayv2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"build+test+package": "npm run build+test && npm run package"
},
"cdk-build": {
"cloudformation": "AWS::ApiGatewayV2"
"cloudformation": "AWS::ApiGatewayV2",
"jest": true
},
"keywords": [
"aws",
Expand All @@ -61,23 +62,6 @@
"url": "https://aws.amazon.com",
"organization": true
},
"jest": {
"moduleFileExtensions": [
"js"
],
"coverageThreshold": {
"global": {
"branches": 60,
"statements": 80
}
},
"collectCoverage": true,
"coverageReporters": [
"lcov",
"html",
"text-summary"
]
},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-appconfig/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ coverage

nyc.config.js
!.eslintrc.js
!jest.config.js
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-appconfig/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ dist
tsconfig.json

.eslintrc.js
jest.config.js
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-appconfig/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const baseConfig = require('../../../tools/cdk-build-tools/config/jest.config');
module.exports = baseConfig;
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-appconfig/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"compat": "cdk-compat"
},
"cdk-build": {
"cloudformation": "AWS::AppConfig"
"cloudformation": "AWS::AppConfig",
"jest": true
},
"keywords": [
"aws",
Expand All @@ -62,7 +63,6 @@
"url": "https://aws.amazon.com",
"organization": true
},
"jest": {},
"license": "Apache-2.0",
"devDependencies": {
"@aws-cdk/assert": "0.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-appstream/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ coverage
dist
tsconfig.json
!.eslintrc.js
!jest.config.js
1 change: 1 addition & 0 deletions packages/@aws-cdk/aws-appstream/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ dist

tsconfig.json
.eslintrc.js
jest.config.js
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-appstream/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const baseConfig = require('../../../tools/cdk-build-tools/config/jest.config');
module.exports = baseConfig;
Loading

0 comments on commit 52ce67b

Please sign in to comment.