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

Provide guidance that any variable with a reference to a DOM element should be nulled #27

Open
notmessenger opened this issue Apr 10, 2017 · 3 comments

Comments

@notmessenger
Copy link
Contributor

KNOWN
@sophypal has discovered that references to DOM elements in acceptance tests that are not assigned null in an afterEach() do not allow garbage collection to be performed and drastically increase the memory footprint of the test suite.

UNKOWN

@sglanzer-deprecated
Copy link
Contributor

I would love love love to have a generic testing solution to look for proper destruction of objects

@sophypal
Copy link
Contributor

sophypal commented Apr 11, 2017

If there are other variables in acceptance tests that cause the same issues (other than what is already identified in #26), or only if it's only DOM ones

Any references held will not be reclaimed but usually not an issue to worry about generally in our tests. DOM nodes specifically need to be addressed because a single detached node will keep the DOM tree alive in memory. To that end, I wouldn't say it increases the memory footprint drastically. Ultimately it will depend on the number of left over references but it would be a good idea to maintain the practice of always unsetting it (when dealing with DOM references).

If this applies to component integration tests as well (meaning is there a time where such assignment is occurring, not that the memory management should be handled any differently).

This would apply to all tests (acceptance/integration/unit). Yes, you can actually render in unit test.

@sophypal
Copy link
Contributor

sophypal commented Apr 11, 2017

So references we should be looking out for that really leaks are Ember objects that hold a reference to the container. ember-test-helpers does a good job of cleaning out test contexts which holds references to the container and registry but we also need to null references to the application instance in Acceptance tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants