Skip to content
This repository was archived by the owner on Mar 5, 2022. It is now read-only.

Commit ffcc1ee

Browse files
committed
fix: add math random to component key prop on mount
1 parent 222b6c2 commit ffcc1ee

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ export const mount = (jsx: React.ReactElement, options: MountOptions = {}) => {
4848
const displayname = getDisplayName(jsx.type, options.alias)
4949

5050
return cy
51-
.window({ log: false })
5251
.then(() => {
5352
if (options.log !== false) {
5453
Cypress.log({
@@ -69,9 +68,11 @@ export const mount = (jsx: React.ReactElement, options: MountOptions = {}) => {
6968

7069
const el = document.getElementById(rootId)
7170

72-
const props = {
71+
const key =
7372
// @ts-ignore provide unique key to the the wrapped component to make sure we are rerendering between tests
74-
key: Cypress?.mocha?.getRunner()?.test?.title || Math.random(),
73+
(Cypress?.mocha?.getRunner()?.test?.title || '') + Math.random()
74+
const props = {
75+
key,
7576
}
7677

7778
const CypressTestComponent = reactDomToUse.render(

0 commit comments

Comments
 (0)