Skip to content
This repository was archived by the owner on Mar 5, 2022. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ export const mount = (jsx: React.ReactElement, options: MountOptions = {}) => {

const el = document.getElementById(rootId)

if (!el) {
throw new Error(
[
'[cypress-react-unit-test] 🔥 Hmm, cannot find root element to mount the component.',
'Did you forget to include the support file?',
'Check https://github.com/bahmutov/cypress-react-unit-test#install please',
].join(' '),
)
}

const key =
// @ts-ignore provide unique key to the the wrapped component to make sure we are rerendering between tests
(Cypress?.mocha?.getRunner()?.test?.title || '') + Math.random()
Expand Down