Skip to content

(clean): remove --env=jsdom as JSDOM is Jest's default#396

Merged
swyxio merged 1 commit into
jaredpalmer:masterfrom
agilgur5:fix-test-env-default
Dec 28, 2019
Merged

(clean): remove --env=jsdom as JSDOM is Jest's default#396
swyxio merged 1 commit into
jaredpalmer:masterfrom
agilgur5:fix-test-env-default

Conversation

@agilgur5

@agilgur5 agilgur5 commented Dec 27, 2019

Copy link
Copy Markdown
Collaborator

Docs seemed to be introduced in 4296413 and template in #68 . This seems to have matched the templating of CRA v1, but this was changed in CRA v2. I'm guessing CRA may have defaulted to node under-the-hood in v1 but I'm not really sure (did not investigate history any further). tsdx seemed to never default to node, so seems like it was always redundant in tsdx.

There's a separate question of whether to use node test environment in the default template, but a non-React library may still be a browser-based library, and therefore might still want to use jsdom.
I think using node is an optimization/option that should be left to the user; setting it to node by default would probably cause more confusion than optimization (and it may not shave off much time, if any, based on my experience at least).

- the React template and docs for it had --env=jsdom explicitly set,
  but there's no need to do this, as Jest uses JSDOM by default already

- setting it a second time in CLI also overrides any custom configs
@swyxio

swyxio commented Dec 28, 2019

Copy link
Copy Markdown
Collaborator

TIL, thank you

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants