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

[enzyme-adapter-react-16] Attempts to access DOM after jest.afterEach cleanup #2523

Open
2 tasks done
Whoaa512 opened this issue Jun 9, 2021 · 2 comments
Open
2 tasks done

Comments

@Whoaa512
Copy link

Whoaa512 commented Jun 9, 2021

Initially found this issue while migrating to jest-circus and filed an issue there but turns out it's an enzyme bug

Link to repro repo

https://github.com/Whoaa512/jest-circus-each-bug

API

  • mount

Version

Versions listed in the repo linked above

Adapter

  • enzyme-adapter-react-16
@Whoaa512 Whoaa512 changed the title [enzyme-adapter-react-16] Attempts to access DOM [enzyme-adapter-react-16] Attempts to access DOM after jest.afterEach cleanup Jun 9, 2021
@ljharb
Copy link
Member

ljharb commented Jun 9, 2021

I'm not sure what you mean, can you elaborate?

@ljharb
Copy link
Member

ljharb commented Jun 9, 2021

Reading the linked issue - you simply must not "clean up" the window, ever. Modules throughout the graph, including react itself, will have cached window on first require, and if you change that later, they'll still have a reference to the previous value.

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

No branches or pull requests

2 participants