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

✅ Clean up global and window state left over after tests #14647

Merged
merged 1 commit into from
Apr 17, 2018
Merged

✅ Clean up global and window state left over after tests #14647

merged 1 commit into from
Apr 17, 2018

Conversation

rsimha
Copy link
Contributor

@rsimha rsimha commented Apr 16, 2018

Partial fix for #14360

@rsimha
Copy link
Contributor Author

rsimha commented Apr 16, 2018

/to @cramforce @erwinmombay @jridgewell

This PR is a brute-force way of deleting all new global and window objects injected by a test. Let me know if you can suggest a better / more elegant way of doing this.

We still need to reset the DOM (I'm working on that in a separate PR).

@rsimha
Copy link
Contributor Author

rsimha commented Apr 17, 2018

Ping.

Travis runs for this PR are both green. Does anyone see any harm in doing this cleanup between tests?

Copy link
Contributor

@jridgewell jridgewell left a comment

Choose a reason for hiding this comment

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

Can we throw instead? How many tests would that fail?

@rsimha
Copy link
Contributor Author

rsimha commented Apr 17, 2018

@jridgewell I tried that, and there are hundreds of tests that are leaving behind global state. Some of it might in fact be cumbersome to clean up in each test, like __AMP_BODY_VISIBLE, and it probably makes sense to do the clean up globally.

I'll revisit this when I refactor the rest of what's happening in _init_tests.js.

@rsimha rsimha merged commit 01eae52 into ampproject:master Apr 17, 2018
@rsimha rsimha deleted the 2018-04-12-GlobalState branch April 17, 2018 18:03
jridgewell pushed a commit to jridgewell/amphtml that referenced this pull request Apr 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants