Skip to content

Commit

Permalink
Move to Set implementation over Array
Browse files Browse the repository at this point in the history
  • Loading branch information
TzviPM committed Aug 9, 2018
1 parent 378f0c5 commit f07fc9c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/enzyme/src/mountTracking.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { get } from './configuration';

let mountedWrappers = [];
const mountedWrappers = new Set();

/**
* Stores a reference to a testing wrapper for later unmounting
Expand All @@ -11,7 +11,7 @@ let mountedWrappers = [];
export function trackMountedWrapper(wrapper) {
const { enableMountTracking } = get();
if (enableMountTracking) {
mountedWrappers.push(wrapper);
mountedWrappers.add(wrapper);
}
}

Expand All @@ -27,5 +27,5 @@ export function trackMountedWrapper(wrapper) {
*/
export function unmountAllWrappers() {
mountedWrappers.forEach(wrapper => wrapper.unmount());
mountedWrappers = [];
mountedWrappers.clear();
}

0 comments on commit f07fc9c

Please sign in to comment.