Skip to content

Commit

Permalink
chore(assertions): explicit feature flags to produce a consistent tem…
Browse files Browse the repository at this point in the history
…plate during tests (#15924)

In v1, the default value of the `@aws-cdk/core:newStyleStackSynthesis` flag is `false`. As a consequence, `Template.fromStack()` generates, by default, a template without the rule and parameter related to bootstrap versions. In v2,  the default value of this flag is `true`. So this test fails in the v2 branch. By explicitly setting the flag to `false`, we ensure that the tests passes on both v1 and v2, regardless of the default values.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
otaviomacedo authored Aug 6, 2021
1 parent 4f65bd8 commit 4ce3182
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/@aws-cdk/assertions/test/template.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CfnResource, Stack } from '@aws-cdk/core';
import { App, CfnResource, Stack } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { Match, Template } from '../lib';

Expand All @@ -25,7 +25,12 @@ describe('Template', () => {
});

test('fromStack', () => {
const stack = new Stack();
const app = new App({
context: {
'@aws-cdk/core:newStyleStackSynthesis': false,
},
});
const stack = new Stack(app);
new CfnResource(stack, 'Foo', {
type: 'Foo::Bar',
properties: {
Expand Down

0 comments on commit 4ce3182

Please sign in to comment.