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

expose jsdom instance for config in tests #20

Open
zcrumbo opened this issue Nov 20, 2019 · 1 comment
Open

expose jsdom instance for config in tests #20

zcrumbo opened this issue Nov 20, 2019 · 1 comment
Labels
enhancement New feature or request reviewed

Comments

@zcrumbo
Copy link
Member

zcrumbo commented Nov 20, 2019

This popped up while trying to write tests that involved sessionStorage - there's no way to do things like change jsdom's window.location.href without having access to the jsdom instance itself.
Can we expose a reference to it as a global in setup script?

@peripateticus
Copy link
Member

Definitely. One workaround that I've used is that you can set window properties via global.window that is set up via jsdom-global. I recently helped someone with this who was trying to write some tests around window.WebSocket.

@peripateticus peripateticus added enhancement New feature or request reviewed labels Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request reviewed
Projects
None yet
Development

No branches or pull requests

2 participants