cypress 10.11.0 → 11.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/angular/CHANGELOG.md +20 -0
- package/angular/README.md +2 -77
- package/angular/dist/index.d.ts +124 -1
- package/angular/dist/index.js +59 -59
- package/lib/cli.js +15 -1
- package/lib/tasks/download.js +3 -7
- package/lib/util.js +2 -2
- package/mount-utils/CHANGELOG.md +14 -0
- package/mount-utils/README.md +7 -24
- package/mount-utils/dist/index.d.ts +25 -39
- package/mount-utils/dist/index.js +33 -112
- package/mount-utils/package.json +1 -0
- package/package.json +3 -3
- package/react/CHANGELOG.md +27 -0
- package/react/README.md +2 -107
- package/react/dist/cypress-react.cjs.js +92 -219
- package/react/dist/cypress-react.esm-bundler.js +92 -220
- package/react/dist/index.d.ts +111 -4
- package/react18/CHANGELOG.md +13 -0
- package/react18/README.md +7 -0
- package/react18/dist/cypress-react.cjs.js +117 -180
- package/react18/dist/cypress-react.esm-bundler.js +103 -167
- package/react18/dist/index.d.ts +78 -6
- package/react18/package.json +1 -0
- package/svelte/CHANGELOG.md +20 -0
- package/svelte/README.md +1 -69
- package/svelte/dist/cypress-svelte.cjs.js +19 -114
- package/svelte/dist/cypress-svelte.esm-bundler.js +19 -114
- package/svelte/dist/index.d.ts +201 -1
- package/types/cypress.d.ts +18 -10
- package/vue/CHANGELOG.md +34 -0
- package/vue/README.md +2 -76
- package/vue/dist/cypress-vue.cjs.js +68 -151
- package/vue/dist/cypress-vue.esm-bundler.js +68 -151
- package/vue/dist/index.d.ts +1352 -104
- package/vue/package.json +1 -1
- package/vue2/CHANGELOG.md +27 -0
- package/vue2/README.md +2 -72
- package/vue2/dist/cypress-vue2.cjs.js +87 -211
- package/vue2/dist/cypress-vue2.esm-bundler.js +86 -210
- package/vue2/dist/index.d.ts +341 -172
- package/vue2/package.json +1 -3
- package/angular/dist/mount.d.ts +0 -112
- package/react/dist/createMount.d.ts +0 -31
- package/react/dist/getDisplayName.d.ts +0 -8
- package/react/dist/mount.d.ts +0 -8
- package/react/dist/mountHook.d.ts +0 -12
- package/react/dist/types.d.ts +0 -45
- package/svelte/dist/mount.d.ts +0 -30
- package/vue/dist/@vue/test-utils/baseWrapper.d.ts +0 -63
- package/vue/dist/@vue/test-utils/components/RouterLinkStub.d.ts +0 -21
- package/vue/dist/@vue/test-utils/config.d.ts +0 -30
- package/vue/dist/@vue/test-utils/constants/dom-events.d.ts +0 -900
- package/vue/dist/@vue/test-utils/createDomEvent.d.ts +0 -9
- package/vue/dist/@vue/test-utils/domWrapper.d.ts +0 -18
- package/vue/dist/@vue/test-utils/emit.d.ts +0 -5
- package/vue/dist/@vue/test-utils/errorWrapper.d.ts +0 -1
- package/vue/dist/@vue/test-utils/index.d.ts +0 -11
- package/vue/dist/@vue/test-utils/interfaces/wrapperLike.d.ts +0 -56
- package/vue/dist/@vue/test-utils/mount.d.ts +0 -35
- package/vue/dist/@vue/test-utils/stubs.d.ts +0 -22
- package/vue/dist/@vue/test-utils/types.d.ts +0 -125
- package/vue/dist/@vue/test-utils/utils/autoUnmount.d.ts +0 -5
- package/vue/dist/@vue/test-utils/utils/compileSlots.d.ts +0 -2
- package/vue/dist/@vue/test-utils/utils/componentName.d.ts +0 -4
- package/vue/dist/@vue/test-utils/utils/find.d.ts +0 -10
- package/vue/dist/@vue/test-utils/utils/flushPromises.d.ts +0 -1
- package/vue/dist/@vue/test-utils/utils/getRootNodes.d.ts +0 -2
- package/vue/dist/@vue/test-utils/utils/isElement.d.ts +0 -1
- package/vue/dist/@vue/test-utils/utils/isElementVisible.d.ts +0 -6
- package/vue/dist/@vue/test-utils/utils/matchName.d.ts +0 -1
- package/vue/dist/@vue/test-utils/utils/stringifyNode.d.ts +0 -1
- package/vue/dist/@vue/test-utils/utils/vueCompatSupport.d.ts +0 -8
- package/vue/dist/@vue/test-utils/utils/vueShared.d.ts +0 -3
- package/vue/dist/@vue/test-utils/utils.d.ts +0 -13
- package/vue/dist/@vue/test-utils/vueWrapper.d.ts +0 -35
- package/vue/dist/@vue/test-utils/wrapperFactory.d.ts +0 -14
@@ -1,54 +1,40 @@
|
|
1
|
+
export declare const ROOT_SELECTOR = "[data-cy-root]";
|
1
2
|
/**
|
2
|
-
*
|
3
|
-
*
|
4
|
-
*
|
3
|
+
* Gets the root element used to mount the component.
|
4
|
+
* @returns {HTMLElement} The root element
|
5
|
+
* @throws {Error} If the root element is not found
|
5
6
|
*/
|
6
|
-
export interface StyleOptions {
|
7
|
-
/**
|
8
|
-
* Creates <link href="..." /> element for each stylesheet
|
9
|
-
* @alias stylesheet
|
10
|
-
*/
|
11
|
-
stylesheets: string | string[];
|
12
|
-
/**
|
13
|
-
* Creates <link href="..." /> element for each stylesheet
|
14
|
-
* @alias stylesheets
|
15
|
-
*/
|
16
|
-
stylesheet: string | string[];
|
17
|
-
/**
|
18
|
-
* Creates <style>...</style> element and inserts given CSS.
|
19
|
-
* @alias styles
|
20
|
-
*/
|
21
|
-
style: string | string[];
|
22
|
-
/**
|
23
|
-
* Creates <style>...</style> element for each given CSS text.
|
24
|
-
* @alias style
|
25
|
-
*/
|
26
|
-
styles: string | string[];
|
27
|
-
/**
|
28
|
-
* Loads each file and creates a <style>...</style> element
|
29
|
-
* with the loaded CSS
|
30
|
-
* @alias cssFile
|
31
|
-
*/
|
32
|
-
cssFiles: string | string[];
|
33
|
-
/**
|
34
|
-
* Single CSS file to load into a <style></style> element
|
35
|
-
* @alias cssFile
|
36
|
-
*/
|
37
|
-
cssFile: string | string[];
|
38
|
-
}
|
39
|
-
export declare const ROOT_SELECTOR = "[data-cy-root]";
|
40
7
|
export declare const getContainerEl: () => HTMLElement;
|
8
|
+
export declare function checkForRemovedStyleOptions(mountingOptions: Record<string, any>): void;
|
9
|
+
/**
|
10
|
+
* Utility function to register CT side effects and run cleanup code during the "test:before:run" Cypress hook
|
11
|
+
* @param optionalCallback Callback to be called before the next test runs
|
12
|
+
*/
|
13
|
+
export declare function setupHooks(optionalCallback?: Function): void;
|
41
14
|
/**
|
42
15
|
* Remove any style or extra link elements from the iframe placeholder
|
43
16
|
* left from any previous test
|
44
17
|
*
|
18
|
+
* Removed as of Cypress 11.0.0
|
19
|
+
* @see https://on.cypress.io/migration-11-0-0-component-testing-updates
|
45
20
|
*/
|
46
21
|
export declare function cleanupStyles(): void;
|
22
|
+
/**
|
23
|
+
* Additional styles to inject into the document.
|
24
|
+
* A component might need 3rd party libraries from CDN,
|
25
|
+
* local CSS files and custom styles.
|
26
|
+
*
|
27
|
+
* Removed as of Cypress 11.0.0.
|
28
|
+
* @see https://on.cypress.io/migration-11-0-0-component-testing-updates
|
29
|
+
*/
|
30
|
+
export declare type StyleOptions = unknown;
|
47
31
|
/**
|
48
32
|
* Injects custom style text or CSS file or 3rd party style resources
|
49
33
|
* into the given document.
|
34
|
+
*
|
35
|
+
* Removed as of Cypress 11.0.0.
|
36
|
+
* @see https://on.cypress.io/migration-11-0-0-component-testing-updates
|
50
37
|
*/
|
51
38
|
export declare const injectStylesBeforeElement: (options: Partial<StyleOptions & {
|
52
39
|
log: boolean;
|
53
|
-
}>, document: Document, el: HTMLElement | null) =>
|
54
|
-
export declare function setupHooks(optionalCallback?: Function): void;
|
40
|
+
}>, document: Document, el: HTMLElement | null) => void;
|
@@ -1,4 +1,9 @@
|
|
1
1
|
export const ROOT_SELECTOR = '[data-cy-root]';
|
2
|
+
/**
|
3
|
+
* Gets the root element used to mount the component.
|
4
|
+
* @returns {HTMLElement} The root element
|
5
|
+
* @throws {Error} If the root element is not found
|
6
|
+
*/
|
2
7
|
export const getContainerEl = () => {
|
3
8
|
const el = document.querySelector(ROOT_SELECTOR);
|
4
9
|
if (el) {
|
@@ -6,122 +11,19 @@ export const getContainerEl = () => {
|
|
6
11
|
}
|
7
12
|
throw Error(`No element found that matches selector ${ROOT_SELECTOR}. Please add a root element with data-cy-root attribute to your "component-index.html" file so that Cypress can attach your component to the DOM.`);
|
8
13
|
};
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
*/
|
14
|
-
export function cleanupStyles() {
|
15
|
-
const styles = document.body.querySelectorAll('[data-cy=injected-style-tag]');
|
16
|
-
styles.forEach((styleElement) => {
|
17
|
-
if (styleElement.parentElement) {
|
18
|
-
styleElement.parentElement.removeChild(styleElement);
|
14
|
+
export function checkForRemovedStyleOptions(mountingOptions) {
|
15
|
+
for (const key of ['cssFile', 'cssFiles', 'style', 'styles', 'stylesheet', 'stylesheets']) {
|
16
|
+
if (mountingOptions[key]) {
|
17
|
+
Cypress.utils.throwErrByPath('mount.removed_style_mounting_options', key);
|
19
18
|
}
|
20
|
-
}
|
21
|
-
const links = document.body.querySelectorAll('[data-cy=injected-stylesheet]');
|
22
|
-
links.forEach((link) => {
|
23
|
-
if (link.parentElement) {
|
24
|
-
link.parentElement.removeChild(link);
|
25
|
-
}
|
26
|
-
});
|
27
|
-
}
|
28
|
-
/**
|
29
|
-
* Insert links to external style resources.
|
30
|
-
*/
|
31
|
-
function insertStylesheets(stylesheets, document, el) {
|
32
|
-
stylesheets.forEach((href) => {
|
33
|
-
const link = document.createElement('link');
|
34
|
-
link.type = 'text/css';
|
35
|
-
link.rel = 'stylesheet';
|
36
|
-
link.href = href;
|
37
|
-
link.dataset.cy = 'injected-stylesheet';
|
38
|
-
document.body.insertBefore(link, el);
|
39
|
-
});
|
40
|
-
}
|
41
|
-
/**
|
42
|
-
* Inserts a single stylesheet element
|
43
|
-
*/
|
44
|
-
function insertStyles(styles, document, el) {
|
45
|
-
styles.forEach((style) => {
|
46
|
-
const styleElement = document.createElement('style');
|
47
|
-
styleElement.dataset.cy = 'injected-style-tag';
|
48
|
-
styleElement.appendChild(document.createTextNode(style));
|
49
|
-
document.body.insertBefore(styleElement, el);
|
50
|
-
});
|
51
|
-
}
|
52
|
-
function insertSingleCssFile(cssFilename, document, el, log) {
|
53
|
-
return cy.readFile(cssFilename, { log }).then((css) => {
|
54
|
-
const style = document.createElement('style');
|
55
|
-
style.appendChild(document.createTextNode(css));
|
56
|
-
document.body.insertBefore(style, el);
|
57
|
-
});
|
58
|
-
}
|
59
|
-
/**
|
60
|
-
* Reads the given CSS file from local file system
|
61
|
-
* and adds the loaded style text as an element.
|
62
|
-
*/
|
63
|
-
function insertLocalCssFiles(cssFilenames, document, el, log) {
|
64
|
-
return Cypress.Promise.mapSeries(cssFilenames, (cssFilename) => {
|
65
|
-
return insertSingleCssFile(cssFilename, document, el, log);
|
66
|
-
});
|
19
|
+
}
|
67
20
|
}
|
68
21
|
/**
|
69
|
-
*
|
70
|
-
*
|
22
|
+
* Utility function to register CT side effects and run cleanup code during the "test:before:run" Cypress hook
|
23
|
+
* @param optionalCallback Callback to be called before the next test runs
|
71
24
|
*/
|
72
|
-
export const injectStylesBeforeElement = (options, document, el) => {
|
73
|
-
if (!el)
|
74
|
-
return;
|
75
|
-
// first insert all stylesheets as Link elements
|
76
|
-
let stylesheets = [];
|
77
|
-
if (typeof options.stylesheet === 'string') {
|
78
|
-
stylesheets.push(options.stylesheet);
|
79
|
-
}
|
80
|
-
else if (Array.isArray(options.stylesheet)) {
|
81
|
-
stylesheets = stylesheets.concat(options.stylesheet);
|
82
|
-
}
|
83
|
-
if (typeof options.stylesheets === 'string') {
|
84
|
-
options.stylesheets = [options.stylesheets];
|
85
|
-
}
|
86
|
-
if (options.stylesheets) {
|
87
|
-
stylesheets = stylesheets.concat(options.stylesheets);
|
88
|
-
}
|
89
|
-
insertStylesheets(stylesheets, document, el);
|
90
|
-
// insert any styles as <style>...</style> elements
|
91
|
-
let styles = [];
|
92
|
-
if (typeof options.style === 'string') {
|
93
|
-
styles.push(options.style);
|
94
|
-
}
|
95
|
-
else if (Array.isArray(options.style)) {
|
96
|
-
styles = styles.concat(options.style);
|
97
|
-
}
|
98
|
-
if (typeof options.styles === 'string') {
|
99
|
-
styles.push(options.styles);
|
100
|
-
}
|
101
|
-
else if (Array.isArray(options.styles)) {
|
102
|
-
styles = styles.concat(options.styles);
|
103
|
-
}
|
104
|
-
insertStyles(styles, document, el);
|
105
|
-
// now load any css files by path and add their content
|
106
|
-
// as <style>...</style> elements
|
107
|
-
let cssFiles = [];
|
108
|
-
if (typeof options.cssFile === 'string') {
|
109
|
-
cssFiles.push(options.cssFile);
|
110
|
-
}
|
111
|
-
else if (Array.isArray(options.cssFile)) {
|
112
|
-
cssFiles = cssFiles.concat(options.cssFile);
|
113
|
-
}
|
114
|
-
if (typeof options.cssFiles === 'string') {
|
115
|
-
cssFiles.push(options.cssFiles);
|
116
|
-
}
|
117
|
-
else if (Array.isArray(options.cssFiles)) {
|
118
|
-
cssFiles = cssFiles.concat(options.cssFiles);
|
119
|
-
}
|
120
|
-
return insertLocalCssFiles(cssFiles, document, el, options.log);
|
121
|
-
};
|
122
25
|
export function setupHooks(optionalCallback) {
|
123
|
-
//
|
124
|
-
// file that is imported by e2e and component support files by default. We don't want CT side effects to run when e2e
|
26
|
+
// We don't want CT side effects to run when e2e
|
125
27
|
// testing so we early return.
|
126
28
|
// System test to verify CT side effects do not pollute e2e: system-tests/test/e2e_with_mount_import_spec.ts
|
127
29
|
if (Cypress.testingType !== 'component') {
|
@@ -136,6 +38,25 @@ export function setupHooks(optionalCallback) {
|
|
136
38
|
// @ts-ignore
|
137
39
|
Cypress.on('test:before:run', () => {
|
138
40
|
optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();
|
139
|
-
cleanupStyles();
|
140
41
|
});
|
141
42
|
}
|
43
|
+
/**
|
44
|
+
* Remove any style or extra link elements from the iframe placeholder
|
45
|
+
* left from any previous test
|
46
|
+
*
|
47
|
+
* Removed as of Cypress 11.0.0
|
48
|
+
* @see https://on.cypress.io/migration-11-0-0-component-testing-updates
|
49
|
+
*/
|
50
|
+
export function cleanupStyles() {
|
51
|
+
Cypress.utils.throwErrByPath('mount.cleanup_styles');
|
52
|
+
}
|
53
|
+
/**
|
54
|
+
* Injects custom style text or CSS file or 3rd party style resources
|
55
|
+
* into the given document.
|
56
|
+
*
|
57
|
+
* Removed as of Cypress 11.0.0.
|
58
|
+
* @see https://on.cypress.io/migration-11-0-0-component-testing-updates
|
59
|
+
*/
|
60
|
+
export const injectStylesBeforeElement = (options, document, el) => {
|
61
|
+
Cypress.utils.throwErrByPath('mount.inject_styles_before_element');
|
62
|
+
};
|
package/mount-utils/package.json
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "cypress",
|
3
|
-
"version": "
|
3
|
+
"version": "11.0.1",
|
4
4
|
"main": "index.js",
|
5
5
|
"scripts": {
|
6
6
|
"postinstall": "node index.js --exec install",
|
@@ -118,8 +118,8 @@
|
|
118
118
|
},
|
119
119
|
"buildInfo": {
|
120
120
|
"commitBranch": "develop",
|
121
|
-
"commitSha": "
|
122
|
-
"commitDate": "2022-
|
121
|
+
"commitSha": "e9e8cadda4fb14d601079018b57425b221a005d9",
|
122
|
+
"commitDate": "2022-11-10T02:43:03.000Z",
|
123
123
|
"stable": true
|
124
124
|
},
|
125
125
|
"description": "Cypress is a next generation front end testing tool built for the modern web",
|
package/react/CHANGELOG.md
CHANGED
@@ -1,3 +1,30 @@
|
|
1
|
+
# [@cypress/react-v7.0.1](https://github.com/cypress-io/cypress/compare/@cypress/react-v7.0.0...@cypress/react-v7.0.1) (2022-11-08)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* make component derived info not throw ([#24571](https://github.com/cypress-io/cypress/issues/24571)) ([838dd4f](https://github.com/cypress-io/cypress/commit/838dd4fa2e0ec56633d0af2faf10a47d190b5594))
|
7
|
+
|
8
|
+
# [@cypress/react-v7.0.0](https://github.com/cypress-io/cypress/compare/@cypress/react-v6.2.1...@cypress/react-v7.0.0) (2022-11-07)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* remove last mounted component upon subsequent mount calls ([#24470](https://github.com/cypress-io/cypress/issues/24470)) ([f39eb1c](https://github.com/cypress-io/cypress/commit/f39eb1c19e0923bda7ae263168fc6448da942d54))
|
14
|
+
* remove some CT functions and props ([#24419](https://github.com/cypress-io/cypress/issues/24419)) ([294985f](https://github.com/cypress-io/cypress/commit/294985f8b3e0fa00ed66d25f88c8814603766074))
|
15
|
+
|
16
|
+
|
17
|
+
### BREAKING CHANGES
|
18
|
+
|
19
|
+
* remove last mounted component upon subsequent mount calls of mount
|
20
|
+
|
21
|
+
# [@cypress/react-v6.2.1](https://github.com/cypress-io/cypress/compare/@cypress/react-v6.2.0...@cypress/react-v6.2.1) (2022-11-01)
|
22
|
+
|
23
|
+
|
24
|
+
### Bug Fixes
|
25
|
+
|
26
|
+
* Hovering over mount in command log does not show component in AUT ([#24346](https://github.com/cypress-io/cypress/issues/24346)) ([355d210](https://github.com/cypress-io/cypress/commit/355d2101d38ea4d1e93b9c571cf77babab2bbbfc))
|
27
|
+
|
1
28
|
# [@cypress/react-v6.2.0](https://github.com/cypress-io/cypress/compare/@cypress/react-v6.1.1...@cypress/react-v6.2.0) (2022-08-30)
|
2
29
|
|
3
30
|
|
package/react/README.md
CHANGED
@@ -1,107 +1,8 @@
|
|
1
1
|
# @cypress/react
|
2
2
|
|
3
|
-
Mount React components in the open source [Cypress.io](https://www.cypress.io/) test runner
|
4
|
-
|
5
|
-
> **Note:** This package is bundled with the `cypress` package and should not need to be installed separately. See the [React Component Testing Docs](https://docs.cypress.io/guides/component-testing/quickstart-react#Configuring-Component-Testing) for mounting React components. Installing and importing `mount` from `@cypress/react` should only be used for advanced use-cases.
|
6
|
-
|
7
|
-
## Install
|
8
|
-
|
9
|
-
- Requires Cypress v7.0.0 or later
|
10
|
-
- Requires [Node](https://nodejs.org/en/) version 12 or above
|
11
|
-
|
12
|
-
```sh
|
13
|
-
npm install --save-dev @cypress/react
|
14
|
-
```
|
15
|
-
|
16
|
-
## Run
|
17
|
-
|
18
|
-
Open cypress test runner
|
19
|
-
```
|
20
|
-
npx cypress open --component
|
21
|
-
```
|
22
|
-
|
23
|
-
If you need to run test in CI
|
24
|
-
```
|
25
|
-
npx cypress run --component
|
26
|
-
```
|
27
|
-
|
28
|
-
For more information, please check the official docs for [running Cypress](https://on.cypress.io/guides/getting-started/opening-the-app#Quick-Configuration) and for [component testing](https://on.cypress.io/guides/component-testing/writing-your-first-component-test).
|
29
|
-
|
30
|
-
## API
|
31
|
-
|
32
|
-
- `mount` is the most important function, allows to mount a given React component as a mini web application and interact with it using Cypress commands
|
33
|
-
- `createMount` factory function that creates new `mount` function with default options
|
34
|
-
- `unmount` removes previously mounted component, mostly useful to test how the component cleans up after itself
|
35
|
-
- `mountHook` mounts a given React Hook in a test component for full testing, see `hooks` example
|
36
|
-
|
37
|
-
## Examples
|
38
|
-
|
39
|
-
```js
|
40
|
-
import React from 'react'
|
41
|
-
import { mount } from '@cypress/react'
|
42
|
-
import { HelloWorld } from './hello-world.jsx'
|
43
|
-
describe('HelloWorld component', () => {
|
44
|
-
it('works', () => {
|
45
|
-
mount(<HelloWorld />)
|
46
|
-
// now use standard Cypress commands
|
47
|
-
cy.contains('Hello World!').should('be.visible')
|
48
|
-
})
|
49
|
-
})
|
50
|
-
```
|
51
|
-
|
52
|
-
Look at the examples in [cypress/component](cypress/component) folder. Here is the list of examples showing various testing scenarios.
|
53
|
-
|
54
|
-
## Options
|
55
|
-
|
56
|
-
In most cases, the component already imports its own styles, thus it looks "right" during the test. If you need another CSS, the simplest way is to import it from the spec file:
|
57
|
-
|
58
|
-
```js
|
59
|
-
// src/Footer.spec.js
|
60
|
-
import './styles/main.css'
|
61
|
-
import Footer from './Footer'
|
62
|
-
it('looks right', () => {
|
63
|
-
// styles are applied
|
64
|
-
mount(<Footer />)
|
65
|
-
})
|
66
|
-
```
|
67
|
-
|
68
|
-
### Extra styles
|
69
|
-
|
70
|
-
You can pass additional styles, css files and external stylesheets to load, see [docs/styles.md](./docs/styles.md) for the full list of options.
|
71
|
-
|
72
|
-
```js
|
73
|
-
const todo = {
|
74
|
-
id: '123',
|
75
|
-
title: 'Write more tests',
|
76
|
-
}
|
77
|
-
mount(<Todo todo={todo} />, {
|
78
|
-
stylesheets: [
|
79
|
-
'https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.css',
|
80
|
-
],
|
81
|
-
})
|
82
|
-
```
|
83
|
-
|
84
|
-
You may also specify the `ReactDOM` package to use. This can be useful in complex monorepo setups that have different versions of React and React DOM installed. If you see an error relating to [mismatching versions of React or React DOM](https://reactjs.org/warnings/invalid-hook-call-warning.html#mismatching-versions-of-react-and-react-dom), this may be the solution. You can do this using the `ReactDom` option:
|
85
|
-
|
86
|
-
```jsx
|
87
|
-
// if you have multiple versions of ReactDom in your monorepo
|
88
|
-
import ReactDom from 'react-dom'
|
89
|
-
|
90
|
-
mount(<Todo todo={todo} />, {
|
91
|
-
stylesheets: [
|
92
|
-
'https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.css',
|
93
|
-
],
|
94
|
-
ReactDom
|
95
|
-
})
|
96
|
-
```
|
97
|
-
|
98
|
-
## Compatibility
|
99
|
-
|
100
|
-
| @cypress/react | cypress |
|
101
|
-
| -------------- | ------- |
|
102
|
-
| <= v5 | <= v9 |
|
103
|
-
| >= v6 | >= v10 |
|
3
|
+
Mount React components in the open source [Cypress.io](https://www.cypress.io/) test runner
|
104
4
|
|
5
|
+
> **Note:** This package is bundled with the `cypress` package and should not need to be installed separately. See the [React Component Testing Docs](https://docs.cypress.io/guides/component-testing/react/overview) for mounting React components. Installing and importing `mount` from `@cypress/react` should only be done for advanced use-cases.
|
105
6
|
## Development
|
106
7
|
|
107
8
|
Run `yarn build` to compile and sync packages to the `cypress` cli package.
|
@@ -110,10 +11,4 @@ Run `yarn cy:open` to open Cypress component testing against real-world examples
|
|
110
11
|
|
111
12
|
Run `yarn test` to execute headless Cypress tests.
|
112
13
|
|
113
|
-
## License
|
114
|
-
|
115
|
-
[![license](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/cypress-io/cypress/blob/develop/LICENSE)
|
116
|
-
|
117
|
-
This project is licensed under the terms of the [MIT license](/LICENSE).
|
118
|
-
|
119
14
|
## [Changelog](./CHANGELOG.md)
|