-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the same changes to aws-cdk-lib.
- Loading branch information
Showing
7 changed files
with
47 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,5 @@ tsconfig.json | |
# exclude cdk artifacts | ||
**/cdk.out | ||
junit.xml | ||
jest.config.js | ||
jest.setup.local.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const baseConfig = require('cdk-build-tools/config/jest.config'); | ||
// no point in collecting coverage for aws-cdk-lib | ||
baseConfig.collectCoverage = false; | ||
baseConfig.setupFiles = ['./jest.setup.local.js']; | ||
module.exports = baseConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// disallow tests (and production code) in aws-cdk-lib from including the @aws-cdk/core module, | ||
// which effectively bans using any @aws-cdk/* module, | ||
// as they all depend on @aws-cdk/core | ||
jest.mock('@aws-cdk/core', () => { | ||
throw new Error('@aws-cdk/core is not available in aws-cdk-lib tests!') | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import * as cfn_inc from '../../cloudformation-include'; | ||
import * as s3 from '../../aws-s3'; | ||
import { Stack } from '../../lib'; | ||
|
||
test('cloudformation-include works in aws-cdk-lib', () => { | ||
const stack = new Stack(); | ||
const cfnInclude = new cfn_inc.CfnInclude(stack, 'Template', { | ||
templateFile: `${__dirname}/minimal-template.json` | ||
}); | ||
const cfnBucket = cfnInclude.getResource('Bucket') as s3.CfnBucket; | ||
|
||
expect(cfnBucket.bucketName).toEqual('my-bucket'); | ||
}); |
10 changes: 10 additions & 0 deletions
10
packages/aws-cdk-lib/test/cfn-include/minimal-template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"Resources": { | ||
"Bucket": { | ||
"Type": "AWS::S3::Bucket", | ||
"Properties": { | ||
"BucketName": "my-bucket" | ||
} | ||
} | ||
} | ||
} |