Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8a1c8e9

Browse files
authored
fix: Guard against process not being defined (#911)
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).
1 parent fe16376 commit 8a1c8e9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎src/index.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {cleanup} from './pure'
55
// this ensures that tests run in isolation from each other
66
// if you don't like this then either import the `pure` module
77
// or set the RTL_SKIP_AUTO_CLEANUP env variable to 'true'.
8-
if (!process.env.RTL_SKIP_AUTO_CLEANUP) {
8+
if (typeofprocess==="undefined"||!process.env?.RTL_SKIP_AUTO_CLEANUP) {
99
// ignore teardown() in code coverage because Jest does not support it
1010
/* istanbul ignore else */
1111
if (typeof afterEach === 'function') {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /