Skip to content

Commit

Permalink
feat: add warnings when globals are missing (#1244)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
MatanBobi and timdeschryver committed Nov 8, 2023
1 parent c04b8f0 commit d80319f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/index.js
Expand Up @@ -20,6 +20,10 @@ if (typeof process === 'undefined' || !process.env?.RTL_SKIP_AUTO_CLEANUP) {
teardown(() => {
cleanup()
})
} else {
console.warn(
`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.`,
)
}

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

Expand Down

0 comments on commit d80319f

Please sign in to comment.