class MatchResult
| Language | Type name |
|---|---|
.NET | Amazon.CDK.Assertions.MatchResult |
Go | github.com/aws/aws-cdk-go/awscdk/v2/assertions#MatchResult |
Java | software.amazon.awscdk.assertions.MatchResult |
Python | aws_cdk.assertions.MatchResult |
TypeScript (source) | aws-cdk-lib » assertions » MatchResult |
The result of Match.test().
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { assertions } from 'aws-cdk-lib';
declare const target: any;
const matchResult = new assertions.MatchResult(target);
Initializer
new MatchResult(target: any)
Parameters
- target
any
Properties
| Name | Type | Description |
|---|---|---|
| fail | number | The cost of the failures so far. |
| fail | number | The number of failures. |
| is | boolean | Whether the match is a success. |
| target | any | The target for which this result was generated. |
failCost
Type:
number
The cost of the failures so far.
failCount
Type:
number
The number of failures.
isSuccess
Type:
boolean
Whether the match is a success.
target
Type:
any
The target for which this result was generated.
Methods
| Name | Description |
|---|---|
| compose(id, inner) | Compose the results of a previous match as a subtree. |
| finished() | Prepare the result to be analyzed. |
| has | Does the result contain any failures. |
| push(matcher, path, message) | DEPRECATED. |
| record | Record a capture against in this match result. |
| record | Record a new failure into this result at a specific path. |
| render | Do a deep render of the match result, showing the structure mismatches in context. |
| to | Render the failed match in a presentable way. |
compose(id, inner)
public compose(id: string, inner: MatchResult): MatchResult
Parameters
- id
string— the id of the parent tree. - inner
MatchResult
Returns
Compose the results of a previous match as a subtree.
finished()
public finished(): MatchResult
Returns
Prepare the result to be analyzed.
This API must be called prior to analyzing these results.
hasFailed()
public hasFailed(): boolean
Returns
boolean
Does the result contain any failures.
If not, the result is a success
push(matcher, path, message)
public push(matcher: Matcher, path: string[], message: string): MatchResult
⚠️ Deprecated: use recordFailure()
Parameters
- matcher
Matcher - path
string[] - message
string
Returns
DEPRECATED.
recordCapture(options)
public recordCapture(options: MatchCapture): void
Parameters
- options
MatchCapture
Record a capture against in this match result.
recordFailure(failure)
public recordFailure(failure: MatchFailure): MatchResult
Parameters
- failure
MatchFailure
Returns
Record a new failure into this result at a specific path.
renderMismatch()
public renderMismatch(): string
Returns
string
Do a deep render of the match result, showing the structure mismatches in context.
toHumanStrings()
public toHumanStrings(): string[]
Returns
string[]
Render the failed match in a presentable way.
Prefer using renderMismatch over this method. It is left for backwards
compatibility for test suites that expect it, but renderMismatch() will
produce better output.

.NET
Go
Java
Python
TypeScript (