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 fd52a59

Browse files
fix: log globals warning only once (#1252)
Resolves #1249
1 parent d80319f commit fd52a59

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎src/index.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ if (typeof process === 'undefined' || !process.env?.RTL_SKIP_AUTO_CLEANUP) {
2020
teardown(() => {
2121
cleanup()
2222
})
23-
} else {
23+
} else if (!process.env.RTL_AFTEREACH_WARNING_LOGGED) {
24+
process.env.RTL_AFTEREACH_WARNING_LOGGED = true
2425
console.warn(
2526
`The current test runner does not support afterEach/teardown hooks. This means we won't be able to run automatic cleanup and you should be calling cleanup() manually.`,
2627
)
@@ -39,7 +40,8 @@ if (typeof process === 'undefined' || !process.env?.RTL_SKIP_AUTO_CLEANUP) {
3940
afterAll(() => {
4041
setReactActEnvironment(previousIsReactActEnvironment)
4142
})
42-
} else {
43+
} else if (!process.env.RTL_AFTERALL_WARNING_LOGGED) {
44+
process.env.RTL_AFTERALL_WARNING_LOGGED = true
4345
console.warn(
4446
'The current test runner does not support beforeAll/afterAll hooks. This means you should be setting IS_REACT_ACT_ENVIRONMENT manually.',
4547
)

0 commit comments

Comments
(0)

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