Skip to content

Commit 2d27d0f

Browse files
authored
chore(assertions): partially revert #18948 (#18998)
Some tests are failing in v2 due to an oversight that had tests depend on user-supplied context. This PR reverts a change made in #18948 that redacted the stack trace for `findXxx()` APIs. Since this is something the user can configure through context values, it is unnecessary. As such, a few tests are now irrelevant. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 6d091c2 commit 2d27d0f

File tree

2 files changed

+2
-17
lines changed

2 files changed

+2
-17
lines changed

packages/@aws-cdk/assertions/lib/private/messages.ts

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export function findMessage(messages: Messages, constructPath: string, props: an
1010
return {};
1111
}
1212

13-
Object.values(result.matches).forEach((m) => handleTrace(m));
1413
return result.matches;
1514
}
1615

packages/@aws-cdk/assertions/test/annotations.test.ts

+2-16
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ describe('Messages', () => {
77
let annotations: _Annotations;
88
beforeAll(() => {
99
stack = new Stack();
10-
const foo = new CfnResource(stack, 'Foo', {
10+
new CfnResource(stack, 'Foo', {
1111
type: 'Foo::Bar',
1212
properties: {
1313
Fred: 'Thud',
1414
},
1515
});
16-
foo.node.setContext('disable-stack-trace', false);
1716

1817
new CfnResource(stack, 'Bar', {
1918
type: 'Foo::Bar',
@@ -61,11 +60,6 @@ describe('Messages', () => {
6160
const result = annotations.findError('*', 'no message looks like this');
6261
expect(result.length).toEqual(0);
6362
});
64-
65-
test('trace is redacted', () => {
66-
const result = annotations.findError('/Default/Foo', Match.anyValue());
67-
expect(result[0].entry.trace).toEqual('redacted');
68-
});
6963
});
7064

7165
describe('hasWarning', () => {
@@ -165,15 +159,7 @@ describe('Multiple Messages on the Resource', () => {
165159
const result2 = annotations.findError('/Default/Bar', Match.stringLikeRegexp('error:.*'));
166160
expect(result2.length).toEqual(2);
167161
const result3 = annotations.findWarning('/Default/Bar', 'warning: Foo::Bar is deprecated');
168-
expect(result3).toEqual([{
169-
level: 'warning',
170-
entry: {
171-
type: 'aws:cdk:warning',
172-
data: 'warning: Foo::Bar is deprecated',
173-
trace: 'redacted',
174-
},
175-
id: '/Default/Bar',
176-
}]);
162+
expect(result3[0].entry.data).toEqual('warning: Foo::Bar is deprecated');
177163
});
178164
});
179165
class MyAspect implements IAspect {

0 commit comments

Comments
 (0)