-
Notifications
You must be signed in to change notification settings - Fork 110
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
Failures in Test hooks like "AfterAll" don't get shown in the Junit Results #214
Conversation
I have one question so far. On this line here: https://github.com/jest-community/jest-junit/pull/214/files#diff-98b33b9b4e6f46484fa6c752c587c61df6f8e15120262d850d62dfa5a55f2144R232 Say you have a syntax error in a test file or it simply cannot be parsed at all by Jest. I think it will still be caught and the description will read that it was a problem with the hook - but it may not be. Am I reading that right? |
With a repro of :
Gives a and actual test results :
|
And a repro of :
on the other hand will raise a so kinda by design here right? |
Yeah I just worry about stating it is a test hook execution failure if it really isn't the issue. Do you think we could make a more generic message such as, "Test execution failure: could be caused by afterAll hook or other hooks."? |
Done! |
@palmerj3 this look good now? |
One small adjustment then I think I'm good to merge this in |
@palmerj3 does the small adjustment look good? |
{ | ||
"console": null, | ||
"failureMessage": null, | ||
"testExecError": "beforeAll has crashed", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update this fixture to match what your logic now produces. Since the error message is now changed this and the test likely need to be updated right?
Problem statement
There are situations where a testcase passes correctly but the afterAll block can fail, this currently leads to a
Junit
output that gives us a false sense that the test fully passes while Jest itself reports back the suite fails.Repro
Here is a simple repro :
Produces a JUNIT of
Jest itself outputs :
From the investigation that @palmerj3 made in this thread here
The community believes we should just create a new testcase for the failure.
Solution
Unfortunately Jest gives us the failure from the execution of the
testHook
in thetestExecError
field.I've added an additional check if that field is not empty and then create a sort of fake
testCase
, to limit duplication I took the liberty of creating a testcase object generator function.Open Questions
This is technically a bug right? so we shouldn't enable this via option but via a major version bump?
#211