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

fix: Guard against process not being defined #68

Merged
merged 1 commit into from
Jan 18, 2023
Merged

fix: Guard against process not being defined #68

merged 1 commit into from
Jan 18, 2023

Conversation

swissspidy
Copy link
Contributor

What: Check for process being defined.

Why: Webpack 5 doesn't shim Node's process object by default anymore. Only instances of process.env.NODE_ENV are replaced statically. This means that unguarded checks of process.env will crash in browser environments (such as Karma).

How: Check for process being defined. This is a port of testing-library/react-testing-library#911

Checklist:

  • Documentation added N/A
  • Tests N/A
  • Typescript definitions updated N/A
  • Ready to be merged

Webpack 5 doesn't shim Node's `process` object by default anymore. Only instances of `process.env.NODE_ENV` are replaced statically. This means that unguarded checks of `process.env` will crash in browser environments (such as Karma).

This is a port of testing-library/react-testing-library#911
@JoviDeCroock JoviDeCroock merged commit b589fbd into testing-library:main Jan 18, 2023
@github-actions
Copy link

🎉 This PR is included in version 3.2.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@swissspidy swissspidy deleted the patch-1 branch January 18, 2023 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants