Skip to content

Commit

Permalink
Dispose document when tearing down JSDom environment (#5955)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjesun authored Apr 10, 2018
1 parent 89d98d3 commit 1a51672
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/jest-environment-jsdom/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ class JSDOMEnvironment {
if (this.errorEventListener) {
this.global.removeEventListener('error', this.errorEventListener);
}
// Dispose "document" to prevent "load" event from triggering.
Object.defineProperty(this.global, 'document', {value: null});
this.global.close();
}
this.errorEventListener = null;
Expand Down

0 comments on commit 1a51672

Please sign in to comment.