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

🐛 Fix HTML report sorting order storage in jQuery unload event #1066

Merged
merged 1 commit into from
Dec 6, 2020
Merged

🐛 Fix HTML report sorting order storage in jQuery unload event #1066

merged 1 commit into from
Dec 6, 2020

Conversation

tiangolo
Copy link
Contributor

🐛 Fix HTML report sorting order storage in jQuery unload event.

This is related to: #986

I'm having a (probably) similar issue. In the generated HTML report, on the console, I'm seeing an error:

Uncaught TypeError: $(...).unload is not a function
    at HTMLDocument.coverage.index_ready (coverage_html.js:227)
    at mightThrow (jquery.min.js:2)
    at process (jquery.min.js:2)

Using $().unload was deprecated and removed in jQuery 3. The recommendation is to use $().on("unload", handler).

I see that it seems the included minified jQuery JS file says it has version 1.11: https://github.com/nedbat/coveragepy/blob/master/coverage/htmlfiles/jquery.min.js#L1

Nevertheless, when I generate an HTML report from scratch in a local project, the minified jQuery I get is indeed 3.x. I have no idea why.

Either way, the method with $().on("unload", handler) works with both versions.

For completeness, I'm on Chrome, on Ubuntu.

@nedbat
Copy link
Owner

nedbat commented Dec 6, 2020

Thanks for the detailed report. How did you install coverage? I have a feeling the jQuery version difference is because you installed with an Ubuntu package rather than with pip install, is that right?

@nedbat nedbat added html bug Something isn't working labels Dec 6, 2020
@nedbat nedbat merged commit b12a97e into nedbat:master Dec 6, 2020
@tiangolo tiangolo deleted the fix-html-jquery-unload branch December 8, 2020 16:10
@tiangolo
Copy link
Contributor Author

tiangolo commented Dec 8, 2020

Not really, I installed through pytest-cov, with Fllit (equivalent to with pip), in a virtual environment.

Thanks for reviewing and merging!

@nedbat
Copy link
Owner

nedbat commented Dec 19, 2020

This is now released as part of coverage 5.3.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working html
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants