Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated logic for when the resultSummary gets set and updated #166

Conversation

willbertSmillbert
Copy link
Contributor

Noticed when using the reporter, that if the tests retry, the Results object would be erroneously populated. Refer to the below screenshot. In this example, there are 5 legitimate tests, with one of them retrying 5 times after failing, as you can see, the results array is getting pushed to each time, regardless if that result already exists. Further more, this is made even worse as each time the results array gets pushed to, the current testSuite state also gets pushed.

So instead of there being 1 test suite, 5 result getting pushed, there is the same test suite 5x being pushed

image

I decide to iterate over the existing results and then push to the array if the result does not exist, and modify the result if it does.

Note; a caveat to this implementation is that for failed tests, only the last instance of it failing will be in the results array

image

This saves having to do filtering later on, but I can update the logic slightly to push each time for test retries rather than replace

package-lock.json Outdated Show resolved Hide resolved
yarn.lock Outdated Show resolved Hide resolved
@willbertSmillbert willbertSmillbert force-pushed the willbertsmillbert-Improvement_Test_Result_Array_Respect_Retries branch from 7e3ef18 to c0527a1 Compare August 13, 2024 00:11
@willbertSmillbert willbertSmillbert force-pushed the willbertsmillbert-Improvement_Test_Result_Array_Respect_Retries branch from 505506f to 7cc3d99 Compare August 13, 2024 00:17
@willbertSmillbert willbertSmillbert deleted the willbertsmillbert-Improvement_Test_Result_Array_Respect_Retries branch August 13, 2024 00:20
@ryanrosello-og ryanrosello-og merged commit 0a384a6 into ryanrosello-og:main Aug 13, 2024
5 checks passed
if (resIndex > -1) {
for (const test of data.testSuite.tests) {
const testIndex = this.result[resIndex].testSuite.tests.findIndex(
(tes) => tes.name === test.name,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also excludes tests to be added per project that it fails - is this intentional? I would like it to report per project that fails a particular test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea this was an oversight

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @willbertSmillbert are you good to fix this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryanrosello-og the project thing appeared resolved by #171 I will have a look at the attachment issue tomorrow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants