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

Commit 574cc62

Browse files
committed
Do not delete loaded scripts when prepearing to ReactDom.render
1 parent 928d102 commit 574cc62

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

cypress.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"viewportHeight": 100,
44
"video": false,
55
"projectId": "z9dxah",
6-
6+
"mountMode": true,
77
"ignoreTestFiles": "*.css",
88
"env": {
99
"cypress-react-unit-test": {

lib/index.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,11 @@ const setAlert = w => {
2020
function renderTestingPlatform() {
2121
cy.log("Prepearing to ReactDOM rendering");
2222

23-
const document = cy.state("document");
24-
document.write`
25-
<head>
26-
<meta charset="utf-8">
27-
</head>
28-
<body>
29-
<div id="cypress-jsdom"></div>
30-
</body>`;
23+
const document = cy.state('document')
24+
25+
const rootNode = document.createElement("div");
26+
rootNode.setAttribute("id", "cypress-jsdom");
27+
document.getElementsByTagName("body")[0].prepend(rootNode);
3128

3229
return cy.get("#cypress-jsdom", { log: false });
3330
}
@@ -64,7 +61,7 @@ interface MountOptions {
6461
```
6562
**/
6663
export const mount = (jsx: React.ReactElement, options: MountOptions = {}) => {
67-
// checkMountModeEnabled();
64+
checkMountModeEnabled();
6865

6966
// Get the display name property via the component constructor
7067
// @ts-ignore FIXME

0 commit comments

Comments
 (0)