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

When using mochawesome and mocha-parallel-tests in tandem, the report generated by mochawesome shows incorrect code #252

Closed
emaxsaun opened this issue Oct 15, 2018 · 4 comments
Labels
bug third-party integration Involves using mochawesome outside of mocha

Comments

@emaxsaun
Copy link

When using mochawesome and mocha-parallel-tests in tandem, the report generated by mochawesome shows incorrect code.

I have a script set up, for example, "npm run test", that runs the following:

mocha-parallel-tests 'test_api/tests/*.js' --reporter mochawesome

The report is generated, and everything looks fine, but when I click into the tests to expand the code/request/call that mocha is making, I can tell that the request is incorrect.

If I run the same script above like so:

mocha 'test_api/tests/*.js' --reporter mochawesome

Then the mochawesome report is generated and the code that is shown is correct, but the test run time is much slower, because I am not using "mocha-parallel-tests"

Please let me know if you need any more information, thanks.

@adamgruber
Copy link
Owner

I believe I've tracked the issue down to this line:

const code = test.fn ? test.fn.toString() : test.body;

I'm not entirely sure why but test.fn.toString() returns the wrong code string which means the test object is not as expected at the time that function is called. It's probably safe to just use test.body at this point but that could be considered a breaking change so I won't make the change until the next major version. As of now there's no release date for the next version.

@adamgruber adamgruber added third-party integration Involves using mochawesome outside of mocha bug labels Oct 16, 2018
@adamgruber
Copy link
Owner

After some more consideration, I opened #254 to solve this without making a breaking change.

@adamgruber
Copy link
Owner

Should be fixed in v3.1.0. Feel free to open another issue if you're still having problems.

@emaxsaun
Copy link
Author

Thank you so much for fixing this. I just tested, it works perfectly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug third-party integration Involves using mochawesome outside of mocha
Projects
None yet
Development

No branches or pull requests

2 participants