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

jest exists before report is generated #19

Closed
RobertGary1 opened this issue Dec 5, 2017 · 12 comments
Closed

jest exists before report is generated #19

RobertGary1 opened this issue Dec 5, 2017 · 12 comments
Assignees

Comments

@RobertGary1
Copy link

The createReport method returns a promise structure. However, when index.js calls the createReport its not expecting a promise so the execution resumes. The report is never generated because jest exists before the writeFile method is ever called.

@Hargne Hargne self-assigned this Dec 5, 2017
@Hargne Hargne added the bug label Dec 5, 2017
@Hargne
Copy link
Owner

Hargne commented Dec 5, 2017

I will have a look at it ASAP!

@RobertGary1
Copy link
Author

Is it an option to use the synchronous I/O calls in nodeJs? Not sure what version of NodeJs introduced them.

@Hargne
Copy link
Owner

Hargne commented Dec 5, 2017

I'm pretty sure it's been possible for a long time to do synchronous calls with fs (correct me if I'm wrong). I'm unsure if that's the solution in this case though. It is a little weird as I haven't heard this from anyone else using the plugin.
What version of Node are you using, by the way?

@RobertGary1
Copy link
Author

I'm using node.js v8.9.1

@Hargne
Copy link
Owner

Hargne commented Dec 6, 2017

I have been trying to reproduce this issue, but without any luck. I'm wondering if there might be something related to the structure of the project that you are working on that causes this issue, since there haven't been any reported issues where the reports haven't been generated up until now.

Theoretically, the asynchronous method createReport should not be aborted just because Jest has initialized prior to it finishing. This is due to the fact that Jest expects the testResultsProcessor (this module) to instantaneously return back the test result (which is done at the end of index.js).

Would you mind attempting to debug what may cause this issue to occur and post any findings here?

Thanks!

@zeevrosental
Copy link

if it helps, i noticed that no report is generated if jest is running with --forceExit.

it seems that it closes before the report is created.

@Hargne
Copy link
Owner

Hargne commented Dec 26, 2017

Closing this for now. Re-open if you still think it is a relevant issue.

@Hargne Hargne closed this as completed Dec 26, 2017
@zeevrosental
Copy link

i think this is still a problem. other reporters are not creating this problem(junit reporter).

@Hargne
Copy link
Owner

Hargne commented Dec 27, 2017

Is is possible to provide more details of the environment you ran the test on (together with --forceExit)? Jest version etc.

I did a test in this project with --forceExit enabled and the test report was successfully generated.

@Hargne Hargne reopened this Dec 27, 2017
@Hargne
Copy link
Owner

Hargne commented Feb 19, 2018

There is a potential fix for this issue in v2.0.0 - see #33

@zeevrosental
Copy link

zeevrosental commented Feb 20, 2018 via email

@Hargne
Copy link
Owner

Hargne commented Feb 20, 2018

@zeevrosental v2.0.0 has now been released. I will mark this issue as resolved for now.

@Hargne Hargne closed this as completed Feb 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants