-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Labels
good first issueGood for newcomersGood for newcomers
Description
Describe the bug
When creating a matcher that has a "large" schema due to mapping over a known array to construct the schema, performance degrades quickly. In this case with 190 items in the array checking 55 fields, it takes over 9 seconds for the verification step.
await spec()
.get(PATH)
.withBearerToken(API_KEY_USER)
.expectStatus(HttpResponseCode._200_Ok)
.expectJsonMatchStrict({
metadata: any(),
result: arrayWith190Items.map((item) => ({
// ... 55 fields checked with a variety of matchers
// Some are matched against the item to make sure result returns the correct
// data in the correct order.
})),
status: 'success'
});Changing the result matcher to use eachLike and then having an .expectJsonMatch step that matches against the array of items only takes 100ms.
To Reproduce
Steps to reproduce the behavior:
- Create a large schema to match against
- Run Test
Expected behavior
Reasonable performance with a large schema to match against
Software (please complete the following information):
- OS: OSX
- NodeJS Version v22.16.0
- Test Runner vitest
- Pactum version 3.8.0
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers