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

Dispose document when tearing down JSDom environment #5955

Merged
merged 1 commit into from
Apr 10, 2018
Merged

Dispose document when tearing down JSDom environment #5955

merged 1 commit into from
Apr 10, 2018

Conversation

mjesun
Copy link
Contributor

@mjesun mjesun commented Apr 10, 2018

The load event is triggered asynchronously by JSDom, and, since it happens into the constructor, nothing can be done.

However, an early check for document existence is done before (as you wouldn't be able to check its status if it's already gone). Based on this, for synchronous tests, we can skip the load event, which was anyway triggered later.

@codecov-io
Copy link

codecov-io commented Apr 10, 2018

Codecov Report

Merging #5955 into master will decrease coverage by <.01%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5955      +/-   ##
==========================================
- Coverage   64.34%   64.33%   -0.01%     
==========================================
  Files         217      217              
  Lines        8285     8286       +1     
  Branches        4        4              
==========================================
  Hits         5331     5331              
- Misses       2953     2954       +1     
  Partials        1        1
Impacted Files Coverage Δ
packages/jest-environment-jsdom/src/index.js 39.02% <0%> (-0.98%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 89d98d3...0a3498d. Read the comment docs.

Copy link
Collaborator

@thymikee thymikee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. A test would be nice to make sure this doesn't change in newer versions of jsdom

@mjesun mjesun merged commit 1a51672 into jestjs:master Apr 10, 2018
@mjesun mjesun deleted the dispose-document branch May 15, 2018 14:16
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants