fix: remove race condition where many suites run in parallel #148
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello! I was attempting to implement the Report Portal jest reporter into our test project when I came across an interesting error. I added some logging statements and this is what I was presented with in my console when I received the failure:
I discovered that, since our test suites run in parallel, the value of
JestReportPortal.tempStepId
was repeatedly getting modified and re-used when finishing test steps, causing the error. After modifying theJestReportPortal._finishStep
method to look intotempStepIds
, the issue no longer happens. I had attempted to remove the reliance onJestReportPortal.tempStepId
entirely, but it seems like theReportingApi
doesn't have a good way of knowing the name of the current test (at least, one that matches the format oftempStepIds
). The only thing I could see that could be used wasglobal.expect.getState().currentTestName
, but that's delimited by spaces instead of forward slashes. Theoretically, the reporter could be modified to use space-delimited names and likely fully support concurrent execution.Please let me know if you need anything else for this PR to be accepted. The issue I was having was a bit tough to test since it relies on tests being finished in a specific order, but I can attempt to do so if necessary. Thanks!