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

Change default test environment to jsdom #5074

Merged
merged 1 commit into from
Sep 24, 2018

Conversation

Timer
Copy link
Contributor

@Timer Timer commented Sep 24, 2018

This changes the default test environment to jsdom, because most people use it anyway.

@nickserv
Copy link
Contributor

nickserv commented Sep 24, 2018

👎 Defaults should be minimal and prevent adding non-standard changes to the environment. This hurts Jest's flexibility outside of DOM testing as most users won't change settings unless they have to (like enabling JSDOM for a DOM test). The opt in for JSDOM is great as is, though there could be warnings adding if a DOM global is accessed without the right environment to reduce confusion.

@gaearon
Copy link
Contributor

gaearon commented Sep 24, 2018

In practice the default already is jsdom. Newly created apps always have --env=jsdom in the scripts and I’ve never seen people remove them. So people who care enough to research and remove it are the same people who can opt out manually. We’re just removing a weird looking option in the default setup for the majority who don’t care.

I also think that people testing React apps are better served by jsdom being on anyway.

@Timer
Copy link
Contributor Author

Timer commented Sep 24, 2018

The tests that ship with the template application require JSDOM and most users go down a path that requires JSDOM.

If you're an advanced user that knows you only need the Node environment, it's still very easy to disable JSDOM (just pass --env=node).

@Timer Timer merged commit 62b0942 into facebook:next Sep 24, 2018
@Timer Timer deleted the switch-env-to-jsdom branch September 24, 2018 15:30
zmitry pushed a commit to zmitry/create-react-app that referenced this pull request Sep 30, 2018
@lock lock bot locked and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants