Skip to content

jsdom documentation removed? and stale link #1774

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

Open
Cobertos opened this issue Jan 26, 2021 · 7 comments
Open

jsdom documentation removed? and stale link #1774

Cobertos opened this issue Jan 26, 2021 · 7 comments
Labels

Comments

@Cobertos
Copy link

Cobertos commented Jan 26, 2021

Documentation Feedback

Seems like the docs have been updated and there's no more examples on how to use this library with jsdom or alternative DOM implementation? It would be nice if that could be added back.

The link in warn-if-no-window.js is also out of date and points to nowhere.

Looks like it was some changes from this commit. Installation does not mention anything about how to install or use jsdom/jsdom-global

@afontcu
Copy link
Member

afontcu commented Jan 26, 2021

Hi! Thank you for your comment 🙌 We decided not to maintain docs for a broader set of tools because it is hard to keep it up to date. See #1610 (comment)

That being said, it is true that comment from the mentioned test should be updated. Fancy to fix it? 😄

@afontcu afontcu added the docs label Jan 26, 2021
@simondean
Copy link

Thanks for a great project. I've come across the same thing that @Cobertos mentioned. When I run my jest based tests with next.js after upgrading some node.js packages. I'm seeing the same message that @Cobertos highlighted:

    [vue-test-utils]: window is undefined, vue-test-utils needs to be run in a browser environment. 
    You can run the tests in node using jsdom 
    See https://vue-test-utils.vuejs.org/guides/#browser-environment for more details.

Just to clarify, @afontcu mentioned the comment from the test needs updating. I might have misunderstood (probably) the message is printed out by vue-test-utils when you're using it in your own tests. It's not printed out by a test in the vue-test-utils codebase.

@simondean
Copy link

This is in a codebase that was previously working fine with vue-test-utils. I'm just in the process of upgrading a number of node.js modules in my codebase, so it's presumably that upgrading that's causing me to see the message above.

@simondean
Copy link

In my case, after upgrading node.js packages and getting this issue, the fix for me was to add this to my jest.config.js file:

  testEnvironment: 'jsdom'

@afontcu
Copy link
Member

afontcu commented Sep 25, 2021

@simondean is it possible that you bumped Jest to v27?

@simondean
Copy link

@afontcu just check and yep I’ve bumped Jest to v27

@afontcu
Copy link
Member

afontcu commented Sep 26, 2021

Then that must be it – Jest v27 flipped defaults for the test environment from "jsdom" to "node": https://jestjs.io/blog/2021/05/25/jest-27#flipping-defaults

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

No branches or pull requests

3 participants