Skip to content

Commit d80319f

Browse files
MatanBobitimdeschryver
andauthoredNov 8, 2023
feat: add warnings when globals are missing (#1244)
* feat: add warnings when globals are missing * revert the istanbul ignore removal * improve error message * Apply suggestions from code review Co-authored-by: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> --------- Co-authored-by: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com>
1 parent c04b8f0 commit d80319f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎src/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ if (typeof process === 'undefined' || !process.env?.RTL_SKIP_AUTO_CLEANUP) {
2020
teardown(() => {
2121
cleanup()
2222
})
23+
} else {
24+
console.warn(
25+
`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.`,
26+
)
2327
}
2428

2529
// No test setup with other test runners available
@@ -35,6 +39,10 @@ if (typeof process === 'undefined' || !process.env?.RTL_SKIP_AUTO_CLEANUP) {
3539
afterAll(() => {
3640
setReactActEnvironment(previousIsReactActEnvironment)
3741
})
42+
} else {
43+
console.warn(
44+
'The current test runner does not support beforeAll/afterAll hooks. This means you should be setting IS_REACT_ACT_ENVIRONMENT manually.',
45+
)
3846
}
3947
}
4048

0 commit comments

Comments
 (0)
Please sign in to comment.