Closed maks-rafalko closed 1 month ago
Could you please re-check the issue using the latest 3.0.0-beta.3
release? All the integrations were revisited (& reworked) recently, we're about to release 3.0.0. If the issue still occurs, we'll be happy to fix it
The issue should be fixed in the latest 3.0.0-beta releases.
Describe the bug
We are using
v2.15.1
and this version incorrectly calculates tests'start
time, which leads to incorrectly calculatedDuration
time on allure report UI.The instance of
AllureTest
is created here on Jest'sadd_test
event:https://github.com/allure-framework/allure-js/blob/d426d79b63386c42c854ede724c36b582e9b3512/packages/allure-jest/src/AllureJest.ts#L95-L98
Then, we set time to
test.testResult.start
:https://github.com/allure-framework/allure-js/blob/d426d79b63386c42c854ede724c36b582e9b3512/packages/allure-js-commons/src/current/AllureTest.ts#L21
The root of the bug is that we should save
start
time ontest_start
event, not onadd_test
. Here:https://github.com/allure-framework/allure-js/blob/d426d79b63386c42c854ede724c36b582e9b3512/packages/allure-jest/src/AllureJest.ts#L101-L103
add_test
event occures for all the tests cases of the fille at the same time, so this is simply not a correct event to save start time of the test..To Reproduce
test()
case, add for examplesleep
for 3 secondsExpected behavior
test()
case, add for examplesleep
for 3 secondsScreenshots
Before:
After adding a fix:
The fix is pretty simple, we just need to save
test.testResult.start
time somewere here ontest_start
event:https://github.com/allure-framework/allure-js/blob/d426d79b63386c42c854ede724c36b582e9b3512/packages/allure-jest/src/AllureJest.ts#L179
If you agree, I can try to provide a PR.