cypress 10.1.0 → 10.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/lib/exec/open.js +1 -2
  2. package/lib/exec/spawn.js +14 -2
  3. package/lib/tasks/download.js +10 -11
  4. package/lib/tasks/install.js +7 -6
  5. package/lib/util.js +54 -10
  6. package/mount-utils/CHANGELOG.md +19 -0
  7. package/mount-utils/dist/index.js +8 -1
  8. package/mount-utils/package.json +1 -1
  9. package/package.json +13 -13
  10. package/react/CHANGELOG.md +44 -0
  11. package/react/dist/cypress-react.browser.js +17 -2
  12. package/react/dist/cypress-react.cjs.js +17 -2
  13. package/react/dist/cypress-react.esm-bundler.js +17 -2
  14. package/react/package.json +1 -3
  15. package/types/cypress.d.ts +3 -3
  16. package/vue/CHANGELOG.md +42 -0
  17. package/vue/README.md +1 -0
  18. package/vue/dist/@vue/test-utils/baseWrapper.d.ts +61 -0
  19. package/vue/dist/@vue/test-utils/components/RouterLinkStub.d.ts +21 -0
  20. package/vue/dist/@vue/test-utils/config.d.ts +28 -0
  21. package/vue/dist/@vue/test-utils/constants/dom-events.d.ts +900 -0
  22. package/vue/dist/@vue/test-utils/createDomEvent.d.ts +9 -0
  23. package/vue/dist/@vue/test-utils/domWrapper.d.ts +18 -0
  24. package/vue/dist/@vue/test-utils/emit.d.ts +4 -0
  25. package/vue/dist/@vue/test-utils/errorWrapper.d.ts +1 -0
  26. package/vue/dist/@vue/test-utils/index.d.ts +10 -0
  27. package/vue/dist/@vue/test-utils/interfaces/wrapperLike.d.ts +56 -0
  28. package/vue/dist/@vue/test-utils/mount.d.ts +33 -0
  29. package/vue/dist/@vue/test-utils/stubs.d.ts +26 -0
  30. package/vue/dist/@vue/test-utils/types.d.ts +125 -0
  31. package/vue/dist/@vue/test-utils/utils/autoUnmount.d.ts +5 -0
  32. package/vue/dist/@vue/test-utils/utils/compileSlots.d.ts +2 -0
  33. package/vue/dist/@vue/test-utils/utils/componentName.d.ts +4 -0
  34. package/vue/dist/@vue/test-utils/utils/find.d.ts +10 -0
  35. package/vue/dist/@vue/test-utils/utils/flushPromises.d.ts +1 -0
  36. package/vue/dist/@vue/test-utils/utils/getRootNodes.d.ts +2 -0
  37. package/vue/dist/@vue/test-utils/utils/isElement.d.ts +1 -0
  38. package/vue/dist/@vue/test-utils/utils/isElementVisible.d.ts +6 -0
  39. package/vue/dist/@vue/test-utils/utils/matchName.d.ts +1 -0
  40. package/vue/dist/@vue/test-utils/utils/stringifyNode.d.ts +1 -0
  41. package/vue/dist/@vue/test-utils/utils/vueCompatSupport.d.ts +8 -0
  42. package/vue/dist/@vue/test-utils/utils/vueShared.d.ts +3 -0
  43. package/vue/dist/@vue/test-utils/utils.d.ts +13 -0
  44. package/vue/dist/@vue/test-utils/vueWrapper.d.ts +34 -0
  45. package/vue/dist/@vue/test-utils/wrapperFactory.d.ts +14 -0
  46. package/vue/dist/cypress-vue.cjs.js +224 -139
  47. package/vue/dist/cypress-vue.esm-bundler.js +224 -140
  48. package/vue/dist/index.d.ts +34 -3
  49. package/vue/package.json +10 -7
  50. package/vue2/CHANGELOG.md +32 -0
  51. package/vue2/dist/cypress-vue2.browser.js +17 -2
  52. package/vue2/dist/cypress-vue2.cjs.js +17 -2
  53. package/vue2/dist/cypress-vue2.esm-bundler.js +17 -2
  54. package/vue2/package.json +2 -4
package/lib/exec/open.js CHANGED
@@ -86,8 +86,7 @@ module.exports = {
86
86
  const args = processOpenOptions(options);
87
87
  return spawn.start(args, {
88
88
  dev: options.dev,
89
- detached: Boolean(options.detached),
90
- stdio: 'inherit'
89
+ detached: Boolean(options.detached)
91
90
  });
92
91
  } catch (err) {
93
92
  if (err.details) {
package/lib/exec/spawn.js CHANGED
@@ -36,8 +36,20 @@ const isRenderWorkerRe = /\.RenderWorker-/; // Chromium (which Electron uses) al
36
36
  // Failure to connect is expected and normal here, but users frequently misidentify these errors as the cause of their problems.
37
37
  // https://github.com/cypress-io/cypress/issues/19299
38
38
 
39
- const isDbusWarning = /Failed to connect to the bus:/;
40
- const GARBAGE_WARNINGS = [isXlibOrLibudevRe, isHighSierraWarningRe, isRenderWorkerRe, isDbusWarning];
39
+ const isDbusWarning = /Failed to connect to the bus:/; // Electron began logging these on self-signed certs with 17.0.0-alpha.4.
40
+ // Once this is fixed upstream this regex can be removed: https://github.com/electron/electron/issues/34583
41
+ // Sample:
42
+ // [3801:0606/152837.383892:ERROR:cert_verify_proc_builtin.cc(681)] CertVerifyProcBuiltin for www.googletagmanager.com failed:
43
+ // ----- Certificate i=0 (OU=Cypress Proxy Server Certificate,O=Cypress Proxy CA,L=Internet,ST=Internet,C=Internet,CN=www.googletagmanager.com) -----
44
+ // ERROR: No matching issuer found
45
+
46
+ const isCertVerifyProcBuiltin = /(^\[.*ERROR:cert_verify_proc_builtin\.cc|^----- Certificate i=0 \(OU=Cypress Proxy|^ERROR: No matching issuer found$)/; // Electron logs a benign warning about WebSwapCGLLayer on MacOS v12 and Electron v18 due to a naming collision in shared libraries.
47
+ // Once this is fixed upstream this regex can be removed: https://github.com/electron/electron/issues/33685
48
+ // Sample:
49
+ // objc[60540]: Class WebSwapCGLLayer is implemented in both /System/Library/Frameworks/WebKit.framework/Versions/A/Frameworks/WebCore.framework/Versions/A/Frameworks/libANGLE-shared.dylib (0x7ffa5a006318) and /{path/to/app}/node_modules/electron/dist/Electron.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Libraries/libGLESv2.dylib (0x10f8a89c8). One of the two will be used. Which one is undefined.
50
+
51
+ const isMacOSElectronWebSwapCGLLayerWarning = /^objc\[\d+\]: Class WebSwapCGLLayer is implemented in both.*Which one is undefined\./;
52
+ const GARBAGE_WARNINGS = [isXlibOrLibudevRe, isHighSierraWarningRe, isRenderWorkerRe, isDbusWarning, isCertVerifyProcBuiltin, isMacOSElectronWebSwapCGLLayerWarning];
41
53
 
42
54
  const isGarbageLineWarning = str => {
43
55
  return _.some(GARBAGE_WARNINGS, re => {
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- const arch = require('arch');
4
-
5
3
  const la = require('lazy-ass');
6
4
 
7
5
  const is = require('check-more-types');
@@ -76,29 +74,29 @@ const getCA = () => {
76
74
  });
77
75
  };
78
76
 
79
- const prepend = urlPath => {
77
+ const prepend = (arch, urlPath) => {
80
78
  const endpoint = url.resolve(getBaseUrl(), urlPath);
81
79
  const platform = os.platform();
82
80
  const pathTemplate = util.getEnv('CYPRESS_DOWNLOAD_PATH_TEMPLATE', true);
83
- return pathTemplate ? pathTemplate.replace(/\\?\$\{endpoint\}/, endpoint).replace(/\\?\$\{platform\}/, platform).replace(/\\?\$\{arch\}/, arch()) : `${endpoint}?platform=${platform}&arch=${arch()}`;
81
+ return pathTemplate ? pathTemplate.replace(/\\?\$\{endpoint\}/, endpoint).replace(/\\?\$\{platform\}/, platform).replace(/\\?\$\{arch\}/, arch) : `${endpoint}?platform=${platform}&arch=${arch}`;
84
82
  };
85
83
 
86
- const getUrl = version => {
84
+ const getUrl = (arch, version) => {
87
85
  if (is.url(version)) {
88
86
  debug('version is already an url', version);
89
87
  return version;
90
88
  }
91
89
 
92
- return version ? prepend(`desktop/${version}`) : prepend('desktop');
90
+ return version ? prepend(arch, `desktop/${version}`) : prepend(arch, 'desktop');
93
91
  };
94
92
 
95
93
  const statusMessage = err => {
96
94
  return err.statusCode ? [err.statusCode, err.statusMessage].join(' - ') : err.toString();
97
95
  };
98
96
 
99
- const prettyDownloadErr = (err, version) => {
97
+ const prettyDownloadErr = (err, url) => {
100
98
  const msg = stripIndent`
101
- URL: ${getUrl(version)}
99
+ URL: ${url}
102
100
  ${statusMessage(err)}
103
101
  `;
104
102
  debug(msg);
@@ -307,7 +305,7 @@ const downloadFromUrl = ({
307
305
  */
308
306
 
309
307
 
310
- const start = opts => {
308
+ const start = async opts => {
311
309
  let {
312
310
  version,
313
311
  downloadDestination,
@@ -327,7 +325,8 @@ const start = opts => {
327
325
  };
328
326
  }
329
327
 
330
- const versionUrl = getUrl(version);
328
+ const arch = await util.getRealArch();
329
+ const versionUrl = getUrl(arch, version);
331
330
  progress.throttle = 100;
332
331
  debug('needed Cypress version: %s', version);
333
332
  debug('source url %s', versionUrl);
@@ -347,7 +346,7 @@ const start = opts => {
347
346
  } : {})
348
347
  });
349
348
  }).catch(err => {
350
- return prettyDownloadErr(err, version);
349
+ return prettyDownloadErr(err, versionUrl);
351
350
  });
352
351
  };
353
352
 
@@ -2,8 +2,6 @@
2
2
 
3
3
  const _ = require('lodash');
4
4
 
5
- const arch = require('arch');
6
-
7
5
  const os = require('os');
8
6
 
9
7
  const path = require('path');
@@ -48,11 +46,11 @@ const {
48
46
  version
49
47
  } = require('../../package.json');
50
48
 
51
- function _getBinaryUrlFromBuildInfo({
49
+ function _getBinaryUrlFromBuildInfo(arch, {
52
50
  commitSha,
53
51
  commitBranch
54
52
  }) {
55
- return `https://cdn.cypress.io/beta/binary/${version}/${os.platform()}-${arch()}/${commitBranch}-${commitSha}/cypress.zip`;
53
+ return `https://cdn.cypress.io/beta/binary/${version}/${os.platform()}-${arch}/${commitBranch}-${commitSha}/cypress.zip`;
56
54
  }
57
55
 
58
56
  const alreadyInstalledMsg = () => {
@@ -154,7 +152,7 @@ const downloadAndUnzip = ({
154
152
 
155
153
  const validateOS = () => {
156
154
  return util.getPlatformInfo().then(platformInfo => {
157
- return platformInfo.match(/(darwin|linux|win32)-x64/);
155
+ return platformInfo.match(/(win32-x64|linux-x64|linux-arm64|darwin-x64|darwin-arm64)/);
158
156
  });
159
157
  };
160
158
  /**
@@ -164,6 +162,7 @@ const validateOS = () => {
164
162
 
165
163
 
166
164
  function getVersionOverride({
165
+ arch,
167
166
  envVarVersion,
168
167
  buildInfo
169
168
  }) {
@@ -184,7 +183,7 @@ function getVersionOverride({
184
183
  * Commit Timestamp: ${buildInfo.commitDate}
185
184
  `));
186
185
  logger.log();
187
- return _getBinaryUrlFromBuildInfo(buildInfo);
186
+ return _getBinaryUrlFromBuildInfo(arch, buildInfo);
188
187
  }
189
188
  }
190
189
 
@@ -226,7 +225,9 @@ const start = async (options = {}) => {
226
225
  }
227
226
 
228
227
  const pkgVersion = util.pkgVersion();
228
+ const arch = await util.getRealArch();
229
229
  const versionOverride = getVersionOverride({
230
+ arch,
230
231
  envVarVersion,
231
232
  buildInfo: options.buildInfo
232
233
  });
package/lib/util.js CHANGED
@@ -433,19 +433,63 @@ const util = {
433
433
  });
434
434
  },
435
435
 
436
- getPlatformInfo() {
437
- return util.getOsVersionAsync().then(version => {
438
- let osArch = arch();
436
+ async getPlatformInfo() {
437
+ const [version, osArch] = await Promise.all([util.getOsVersionAsync(), this.getRealArch()]);
438
+ return stripIndent`
439
+ Platform: ${os.platform()}-${osArch} (${version})
440
+ Cypress Version: ${util.pkgVersion()}
441
+ `;
442
+ },
443
+
444
+ _cachedArch: undefined,
439
445
 
440
- if (osArch === 'x86') {
441
- osArch = 'ia32';
446
+ /**
447
+ * Attempt to return the real system arch (not process.arch, which is only the Node binary's arch)
448
+ */
449
+ async getRealArch() {
450
+ if (this._cachedArch) return this._cachedArch;
451
+
452
+ async function _getRealArch() {
453
+ const osPlatform = os.platform(); // eslint-disable-next-line no-restricted-syntax
454
+
455
+ const osArch = os.arch();
456
+ debug('detecting arch %o', {
457
+ osPlatform,
458
+ osArch
459
+ });
460
+ if (osArch === 'arm64') return 'arm64';
461
+
462
+ if (osPlatform === 'darwin') {
463
+ // could possibly be x64 node on arm64 darwin, check if we are being translated by Rosetta
464
+ // https://stackoverflow.com/a/65347893/3474615
465
+ const {
466
+ stdout
467
+ } = await execa('sysctl', ['-n', 'sysctl.proc_translated']).catch(() => '');
468
+ debug('rosetta check result: %o', {
469
+ stdout
470
+ });
471
+ if (stdout === '1') return 'arm64';
442
472
  }
443
473
 
444
- return stripIndent`
445
- Platform: ${os.platform()}-${osArch} (${version})
446
- Cypress Version: ${util.pkgVersion()}
447
- `;
448
- });
474
+ if (osPlatform === 'linux') {
475
+ // could possibly be x64 node on arm64 linux, check the "machine hardware name"
476
+ // list of names for reference: https://stackoverflow.com/a/45125525/3474615
477
+ const {
478
+ stdout
479
+ } = await execa('uname', ['-m']).catch(() => '');
480
+ debug('arm uname -m result: %o ', {
481
+ stdout
482
+ });
483
+ if (['aarch64_be', 'aarch64', 'armv8b', 'armv8l'].includes(stdout)) return 'arm64';
484
+ } // eslint-disable-next-line no-restricted-syntax
485
+
486
+
487
+ const pkgArch = arch();
488
+ if (pkgArch === 'x86') return 'ia32';
489
+ return pkgArch;
490
+ }
491
+
492
+ return this._cachedArch = await _getRealArch();
449
493
  },
450
494
 
451
495
  // attention:
@@ -1,3 +1,22 @@
1
+ # [@cypress/mount-utils-v2.0.0](https://github.com/cypress-io/cypress/compare/@cypress/mount-utils-v1.0.2...@cypress/mount-utils-v2.0.0) (2022-06-13)
2
+
3
+
4
+ ### chore
5
+
6
+ * prep npm packages for use with Cypress v10 ([b924d08](https://github.com/cypress-io/cypress/commit/b924d086ee2e2ccc93303731e001b2c9e9d0af17))
7
+
8
+
9
+ ### Features
10
+
11
+ * embedding mount into the cypress binary (real dependency) ([#20930](https://github.com/cypress-io/cypress/issues/20930)) ([3fe5f50](https://github.com/cypress-io/cypress/commit/3fe5f50e7832a4bfb20df8e71648434eb7f263d5))
12
+ * merging / delegating remote queries to cloud schema ([#17875](https://github.com/cypress-io/cypress/issues/17875)) ([94541d4](https://github.com/cypress-io/cypress/commit/94541d4f18591e8fa4b8702c39e92b0a7238aa5d))
13
+ * swap the #__cy_root id selector to become data-cy-root for component mounting ([#20951](https://github.com/cypress-io/cypress/issues/20951)) ([0e7b555](https://github.com/cypress-io/cypress/commit/0e7b555f93fb403f431c5de4a07ae7ad6ac89ba2))
14
+
15
+
16
+ ### BREAKING CHANGES
17
+
18
+ * new version of packages for Cypress v10
19
+
1
20
  # [@cypress/mount-utils-v1.0.2](https://github.com/cypress-io/cypress/compare/@cypress/mount-utils-v1.0.1...@cypress/mount-utils-v1.0.2) (2021-04-30)
2
21
 
3
22
 
@@ -4,7 +4,7 @@ export const getContainerEl = () => {
4
4
  if (el) {
5
5
  return el;
6
6
  }
7
- throw Error(`No element found that matches selector ${ROOT_SELECTOR}. Please use the mount utils to mount it properly`);
7
+ 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
8
  };
9
9
  /**
10
10
  * Remove any style or extra link elements from the iframe placeholder
@@ -120,6 +120,13 @@ export const injectStylesBeforeElement = (options, document, el) => {
120
120
  return insertLocalCssFiles(cssFiles, document, el, options.log);
121
121
  };
122
122
  export function setupHooks(optionalCallback) {
123
+ // Consumed by the framework "mount" libs. A user might register their own mount in the scaffolded 'commands.js'
124
+ // file that is imported by e2e and component support files by default. We don't want CT side effects to run when e2e
125
+ // testing so we early return.
126
+ // System test to verify CT side effects do not pollute e2e: system-tests/test/e2e_with_mount_import_spec.ts
127
+ if (Cypress.testingType !== 'component') {
128
+ return;
129
+ }
123
130
  // When running component specs, we cannot allow "cy.visit"
124
131
  // because it will wipe out our preparation work, and does not make much sense
125
132
  // thus we overwrite "cy.visit" to throw an error
@@ -2,7 +2,6 @@
2
2
  "name": "@cypress/mount-utils",
3
3
  "version": "0.0.0-development",
4
4
  "description": "Shared utilities for the various component testing adapters",
5
- "private": true,
6
5
  "main": "dist/index.js",
7
6
  "scripts": {
8
7
  "build": "tsc || echo 'built, with type errors'",
@@ -18,6 +17,7 @@
18
17
  "files": [
19
18
  "dist"
20
19
  ],
20
+ "types": "dist/index.d.ts",
21
21
  "license": "MIT",
22
22
  "repository": {
23
23
  "type": "git",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cypress",
3
- "version": "10.1.0",
3
+ "version": "10.3.1",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "postinstall": "node index.js --exec install",
@@ -72,15 +72,18 @@
72
72
  "exports": {
73
73
  ".": {
74
74
  "import": "./index.mjs",
75
- "require": "./index.js"
75
+ "require": "./index.js",
76
+ "types": "./types/index.d.ts"
76
77
  },
77
78
  "./vue": {
78
79
  "import": "./vue/dist/cypress-vue.esm-bundler.js",
79
- "require": "./vue/dist/cypress-vue.cjs.js"
80
+ "require": "./vue/dist/cypress-vue.cjs.js",
81
+ "types": "./vue/dist/index.d.ts"
80
82
  },
81
83
  "./vue2": {
82
84
  "import": "./vue2/dist/cypress-vue2.esm-bundler.js",
83
- "require": "./vue2/dist/cypress-vue2.cjs.js"
85
+ "require": "./vue2/dist/cypress-vue2.cjs.js",
86
+ "types": "./vue2/dist/index.d.ts"
84
87
  },
85
88
  "./package.json": {
86
89
  "import": "./package.json",
@@ -88,21 +91,18 @@
88
91
  },
89
92
  "./react": {
90
93
  "import": "./react/dist/cypress-react.esm-bundler.js",
91
- "require": "./react/dist/cypress-react.cjs.js"
94
+ "require": "./react/dist/cypress-react.cjs.js",
95
+ "types": "./react/dist/index.d.ts"
92
96
  },
93
97
  "./mount-utils": {
94
- "require": "./mount-utils/dist/index.js"
98
+ "require": "./mount-utils/dist/index.js",
99
+ "types": "./mount-utils/dist/index.d.ts"
95
100
  }
96
101
  },
97
- "workspaces": {
98
- "nohoist": [
99
- "@types/*"
100
- ]
101
- },
102
102
  "buildInfo": {
103
103
  "commitBranch": "develop",
104
- "commitSha": "72e6b882bd3f09857baf70b3552fef4ce484ed4f",
105
- "commitDate": "2022-06-10T16:14:18.000Z",
104
+ "commitSha": "0aebe4a47d49c94d519fc00af81967ed8da65483",
105
+ "commitDate": "2022-07-18T17:25:43.000Z",
106
106
  "stable": true
107
107
  },
108
108
  "description": "Cypress.io end to end testing tool",
@@ -1,3 +1,47 @@
1
+ # [@cypress/react-v6.0.0](https://github.com/cypress-io/cypress/compare/@cypress/react-v5.12.5...@cypress/react-v6.0.0) (2022-06-13)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * open browser at correct time during lifecycle ([#19572](https://github.com/cypress-io/cypress/issues/19572)) ([bfc032a](https://github.com/cypress-io/cypress/commit/bfc032a2d42d0726b8a4a86aab1584bd4e69c3f0))
7
+ * scaffold correct config file ([#19776](https://github.com/cypress-io/cypress/issues/19776)) ([8f32960](https://github.com/cypress-io/cypress/commit/8f32960ef803f539f065d41f01fff33bfe33ed5d))
8
+ * scope config to current testing type ([#20677](https://github.com/cypress-io/cypress/issues/20677)) ([61f7cfc](https://github.com/cypress-io/cypress/commit/61f7cfc59284a2938e0a1c15d74ee75215ba5f8b))
9
+ * terminal error message for non migrated config ([#21467](https://github.com/cypress-io/cypress/issues/21467)) ([3274da7](https://github.com/cypress-io/cypress/commit/3274da7842f5ef1ddad62b1c630d0ff9120e4289))
10
+ * update scaffold template to use correct path ([#20047](https://github.com/cypress-io/cypress/issues/20047)) ([6e80359](https://github.com/cypress-io/cypress/commit/6e803597a379222cf936e5977c8314d693ee1912))
11
+ * wire up scaffolded indexHtml to dev servers ([#20453](https://github.com/cypress-io/cypress/issues/20453)) ([3a8797e](https://github.com/cypress-io/cypress/commit/3a8797e54db9fd0ef93a14ddc71c138ba8251e53))
12
+ * **react:** link to rerender example ([#19020](https://github.com/cypress-io/cypress/issues/19020)) ([552d3a1](https://github.com/cypress-io/cypress/commit/552d3a1c0073dae0bd1da0fc9fa8d140ec4f38dc))
13
+ * **unified-desktop-gui branch:** initial installation on windows ([#18247](https://github.com/cypress-io/cypress/issues/18247)) ([8614e97](https://github.com/cypress-io/cypress/commit/8614e978029bcbf7155b7ae98ac54feb11f2e7f3))
14
+ * **unify:** improve dev server config ergonomics ([#19957](https://github.com/cypress-io/cypress/issues/19957)) ([6a402a7](https://github.com/cypress-io/cypress/commit/6a402a70767f53e4c5ea54490a03a9983b2be10f))
15
+
16
+
17
+ ### chore
18
+
19
+ * prep npm packages for use with Cypress v10 ([b924d08](https://github.com/cypress-io/cypress/commit/b924d086ee2e2ccc93303731e001b2c9e9d0af17))
20
+
21
+
22
+ ### Features
23
+
24
+ * add devServer to config file ([#18962](https://github.com/cypress-io/cypress/issues/18962)) ([2573375](https://github.com/cypress-io/cypress/commit/2573375b5b6616efd2d213a94cd55fd8e0385864))
25
+ * Add typings for new devServer config ([#18797](https://github.com/cypress-io/cypress/issues/18797)) ([e018a14](https://github.com/cypress-io/cypress/commit/e018a14c211bfcbdc4568a9a737f14f5c1686e35))
26
+ * Deprecate run-ct / open-ct, and update all examples to use --ct instead ([#18422](https://github.com/cypress-io/cypress/issues/18422)) ([196e8f6](https://github.com/cypress-io/cypress/commit/196e8f62cc6d27974f235945cb5700624b3dae41))
27
+ * embedding mount into the cypress binary (real dependency) ([#20930](https://github.com/cypress-io/cypress/issues/20930)) ([3fe5f50](https://github.com/cypress-io/cypress/commit/3fe5f50e7832a4bfb20df8e71648434eb7f263d5))
28
+ * index.html configurability and storybook support ([#18242](https://github.com/cypress-io/cypress/issues/18242)) ([745b3ac](https://github.com/cypress-io/cypress/commit/745b3ac4518302983522daedf817623334feae5b))
29
+ * ProjectLifecycleManager & general launchpad cleanup ([#19347](https://github.com/cypress-io/cypress/issues/19347)) ([4626f74](https://github.com/cypress-io/cypress/commit/4626f7481c9904fec484aa167a02e0197a3095c4))
30
+ * remove testFiles reference ([#20565](https://github.com/cypress-io/cypress/issues/20565)) ([5670344](https://github.com/cypress-io/cypress/commit/567034459089d9d53dfab5556cb9369fb335c3db))
31
+ * support specPattern, deprecate integrationFolder and componentFolder ([#19319](https://github.com/cypress-io/cypress/issues/19319)) ([792980a](https://github.com/cypress-io/cypress/commit/792980ac12746ef47b9c944ebe4c6c353a187ab2))
32
+ * swap the #__cy_root id selector to become data-cy-root for component mounting ([#20951](https://github.com/cypress-io/cypress/issues/20951)) ([0e7b555](https://github.com/cypress-io/cypress/commit/0e7b555f93fb403f431c5de4a07ae7ad6ac89ba2))
33
+ * update on-links ([#19235](https://github.com/cypress-io/cypress/issues/19235)) ([cc2d734](https://github.com/cypress-io/cypress/commit/cc2d7348185e2a090c60d92d9319ab460d8c7827))
34
+ * Use .config files ([#18578](https://github.com/cypress-io/cypress/issues/18578)) ([081dd19](https://github.com/cypress-io/cypress/commit/081dd19cc6da3da229a7af9c84f62730c85a5cd6))
35
+ * use devServer instad of startDevServer ([#20092](https://github.com/cypress-io/cypress/issues/20092)) ([8a6768f](https://github.com/cypress-io/cypress/commit/8a6768fee6f46b908c5a9daf23da8b804a6c627f))
36
+ * Use plugins on config files ([#18798](https://github.com/cypress-io/cypress/issues/18798)) ([bb8251b](https://github.com/cypress-io/cypress/commit/bb8251b752ac44f1184f9160194cf12d41fc867f))
37
+ * use supportFile by testingType ([#19364](https://github.com/cypress-io/cypress/issues/19364)) ([0366d4f](https://github.com/cypress-io/cypress/commit/0366d4fa8971e5e5189c6fd6450cc3c8d72dcfe1))
38
+ * validate specPattern root level ([#19980](https://github.com/cypress-io/cypress/issues/19980)) ([5d52758](https://github.com/cypress-io/cypress/commit/5d52758d82c47033803c69c7858fc786a900faaf))
39
+
40
+
41
+ ### BREAKING CHANGES
42
+
43
+ * new version of packages for Cypress v10
44
+
1
45
  # [@cypress/react-v5.12.5](https://github.com/cypress-io/cypress/compare/@cypress/react-v5.12.4...@cypress/react-v5.12.5) (2022-05-17)
2
46
 
3
47
 
@@ -29,7 +29,7 @@ var CypressReact = (function (exports, React, ReactDOM) {
29
29
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
30
30
  var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
31
31
 
32
- /*! *****************************************************************************
32
+ /******************************************************************************
33
33
  Copyright (c) Microsoft Corporation.
34
34
 
35
35
  Permission to use, copy, modify, and/or distribute this software for any
@@ -106,7 +106,7 @@ var CypressReact = (function (exports, React, ReactDOM) {
106
106
  if (el) {
107
107
  return el;
108
108
  }
109
- throw Error(`No element found that matches selector ${ROOT_SELECTOR}. Please use the mount utils to mount it properly`);
109
+ 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.`);
110
110
  };
111
111
  /**
112
112
  * Remove any style or extra link elements from the iframe placeholder
@@ -222,6 +222,13 @@ var CypressReact = (function (exports, React, ReactDOM) {
222
222
  return insertLocalCssFiles(cssFiles, document, el, options.log);
223
223
  };
224
224
  function setupHooks(optionalCallback) {
225
+ // Consumed by the framework "mount" libs. A user might register their own mount in the scaffolded 'commands.js'
226
+ // file that is imported by e2e and component support files by default. We don't want CT side effects to run when e2e
227
+ // testing so we early return.
228
+ // System test to verify CT side effects do not pollute e2e: system-tests/test/e2e_with_mount_import_spec.ts
229
+ if (Cypress.testingType !== 'component') {
230
+ return;
231
+ }
225
232
  // When running component specs, we cannot allow "cy.visit"
226
233
  // because it will wipe out our preparation work, and does not make much sense
227
234
  // thus we overwrite "cy.visit" to throw an error
@@ -419,6 +426,14 @@ var CypressReact = (function (exports, React, ReactDOM) {
419
426
  return mount(element, __assign(__assign({}, defaultOptions), options));
420
427
  };
421
428
  };
429
+ // Side effects from "import { mount } from '@cypress/<my-framework>'" are annoying, we should avoid doing this
430
+ // by creating an explicit function/import that the user can register in their 'component.js' support file,
431
+ // such as:
432
+ // import 'cypress/<my-framework>/support'
433
+ // or
434
+ // import { registerCT } from 'cypress/<my-framework>'
435
+ // registerCT()
436
+ // Note: This would be a breaking change
422
437
  // it is required to unmount component in beforeEach hook in order to provide a clean state inside test
423
438
  // because `mount` can be called after some preparation that can side effect unmount
424
439
  // @see npm/react/cypress/component/advanced/set-timeout-example/loading-indicator-spec.js
@@ -33,7 +33,7 @@ function _interopNamespace(e) {
33
33
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
34
34
  var ReactDOM__namespace = /*#__PURE__*/_interopNamespace(ReactDOM);
35
35
 
36
- /*! *****************************************************************************
36
+ /******************************************************************************
37
37
  Copyright (c) Microsoft Corporation.
38
38
 
39
39
  Permission to use, copy, modify, and/or distribute this software for any
@@ -110,7 +110,7 @@ const getContainerEl = () => {
110
110
  if (el) {
111
111
  return el;
112
112
  }
113
- throw Error(`No element found that matches selector ${ROOT_SELECTOR}. Please use the mount utils to mount it properly`);
113
+ 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.`);
114
114
  };
115
115
  /**
116
116
  * Remove any style or extra link elements from the iframe placeholder
@@ -226,6 +226,13 @@ const injectStylesBeforeElement = (options, document, el) => {
226
226
  return insertLocalCssFiles(cssFiles, document, el, options.log);
227
227
  };
228
228
  function setupHooks(optionalCallback) {
229
+ // Consumed by the framework "mount" libs. A user might register their own mount in the scaffolded 'commands.js'
230
+ // file that is imported by e2e and component support files by default. We don't want CT side effects to run when e2e
231
+ // testing so we early return.
232
+ // System test to verify CT side effects do not pollute e2e: system-tests/test/e2e_with_mount_import_spec.ts
233
+ if (Cypress.testingType !== 'component') {
234
+ return;
235
+ }
229
236
  // When running component specs, we cannot allow "cy.visit"
230
237
  // because it will wipe out our preparation work, and does not make much sense
231
238
  // thus we overwrite "cy.visit" to throw an error
@@ -423,6 +430,14 @@ var createMount = function (defaultOptions) {
423
430
  return mount(element, __assign(__assign({}, defaultOptions), options));
424
431
  };
425
432
  };
433
+ // Side effects from "import { mount } from '@cypress/<my-framework>'" are annoying, we should avoid doing this
434
+ // by creating an explicit function/import that the user can register in their 'component.js' support file,
435
+ // such as:
436
+ // import 'cypress/<my-framework>/support'
437
+ // or
438
+ // import { registerCT } from 'cypress/<my-framework>'
439
+ // registerCT()
440
+ // Note: This would be a breaking change
426
441
  // it is required to unmount component in beforeEach hook in order to provide a clean state inside test
427
442
  // because `mount` can be called after some preparation that can side effect unmount
428
443
  // @see npm/react/cypress/component/advanced/set-timeout-example/loading-indicator-spec.js
@@ -8,7 +8,7 @@
8
8
  import * as React from 'react';
9
9
  import * as ReactDOM from 'react-dom';
10
10
 
11
- /*! *****************************************************************************
11
+ /******************************************************************************
12
12
  Copyright (c) Microsoft Corporation.
13
13
 
14
14
  Permission to use, copy, modify, and/or distribute this software for any
@@ -85,7 +85,7 @@ const getContainerEl = () => {
85
85
  if (el) {
86
86
  return el;
87
87
  }
88
- throw Error(`No element found that matches selector ${ROOT_SELECTOR}. Please use the mount utils to mount it properly`);
88
+ 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.`);
89
89
  };
90
90
  /**
91
91
  * Remove any style or extra link elements from the iframe placeholder
@@ -201,6 +201,13 @@ const injectStylesBeforeElement = (options, document, el) => {
201
201
  return insertLocalCssFiles(cssFiles, document, el, options.log);
202
202
  };
203
203
  function setupHooks(optionalCallback) {
204
+ // Consumed by the framework "mount" libs. A user might register their own mount in the scaffolded 'commands.js'
205
+ // file that is imported by e2e and component support files by default. We don't want CT side effects to run when e2e
206
+ // testing so we early return.
207
+ // System test to verify CT side effects do not pollute e2e: system-tests/test/e2e_with_mount_import_spec.ts
208
+ if (Cypress.testingType !== 'component') {
209
+ return;
210
+ }
204
211
  // When running component specs, we cannot allow "cy.visit"
205
212
  // because it will wipe out our preparation work, and does not make much sense
206
213
  // thus we overwrite "cy.visit" to throw an error
@@ -398,6 +405,14 @@ var createMount = function (defaultOptions) {
398
405
  return mount(element, __assign(__assign({}, defaultOptions), options));
399
406
  };
400
407
  };
408
+ // Side effects from "import { mount } from '@cypress/<my-framework>'" are annoying, we should avoid doing this
409
+ // by creating an explicit function/import that the user can register in their 'component.js' support file,
410
+ // such as:
411
+ // import 'cypress/<my-framework>/support'
412
+ // or
413
+ // import { registerCT } from 'cypress/<my-framework>'
414
+ // registerCT()
415
+ // Note: This would be a breaking change
401
416
  // it is required to unmount component in beforeEach hook in order to provide a clean state inside test
402
417
  // because `mount` can be called after some preparation that can side effect unmount
403
418
  // @see npm/react/cypress/component/advanced/set-timeout-example/loading-indicator-spec.js
@@ -2,7 +2,6 @@
2
2
  "name": "@cypress/react",
3
3
  "version": "0.0.0-development",
4
4
  "description": "Test React components using Cypress",
5
- "private": true,
6
5
  "main": "dist/cypress-react.cjs.js",
7
6
  "scripts": {
8
7
  "build": "rimraf dist && rollup -c rollup.config.js",
@@ -44,8 +43,7 @@
44
43
  "react-dom": "^=16.x || ^=17.x"
45
44
  },
46
45
  "files": [
47
- "dist",
48
- "support"
46
+ "dist"
49
47
  ],
50
48
  "types": "dist/index.d.ts",
51
49
  "license": "MIT",
@@ -2941,7 +2941,7 @@ declare namespace Cypress {
2941
2941
  /**
2942
2942
  * Hosts mappings to IP addresses.
2943
2943
  */
2944
- hosts: null | string[]
2944
+ hosts: null | {[key: string]: string}
2945
2945
  /**
2946
2946
  * Whether Cypress was launched via 'cypress open' (interactive mode)
2947
2947
  */
@@ -3003,7 +3003,7 @@ declare namespace Cypress {
3003
3003
  xhrUrl: string
3004
3004
  }
3005
3005
 
3006
- interface TestConfigOverrides extends Partial<Pick<ConfigOptions, 'animationDistanceThreshold' | 'blockHosts' | 'defaultCommandTimeout' | 'env' | 'execTimeout' | 'includeShadowDom' | 'numTestsKeptInMemory' | 'pageLoadTimeout' | 'redirectionLimit' | 'requestTimeout' | 'responseTimeout' | 'retries' | 'screenshotOnRunFailure' | 'slowTestThreshold' | 'scrollBehavior' | 'taskTimeout' | 'viewportHeight' | 'viewportWidth' | 'waitForAnimations' | 'experimentalSessionAndOrigin'>> {
3006
+ interface TestConfigOverrides extends Partial<Pick<ConfigOptions, 'animationDistanceThreshold' | 'blockHosts' | 'defaultCommandTimeout' | 'env' | 'execTimeout' | 'includeShadowDom' | 'numTestsKeptInMemory' | 'pageLoadTimeout' | 'redirectionLimit' | 'requestTimeout' | 'responseTimeout' | 'retries' | 'screenshotOnRunFailure' | 'slowTestThreshold' | 'scrollBehavior' | 'taskTimeout' | 'viewportHeight' | 'viewportWidth' | 'waitForAnimations' | 'experimentalSessionAndOrigin'>>, Partial<Pick<ResolvedConfigOptions, 'baseUrl'>> {
3007
3007
  browser?: IsBrowserMatcher | IsBrowserMatcher[]
3008
3008
  keystrokeDelay?: number
3009
3009
  }
@@ -5500,7 +5500,7 @@ declare namespace Cypress {
5500
5500
 
5501
5501
  interface DevServerConfig {
5502
5502
  specs: Spec[]
5503
- config: ResolvedConfigOptions & RuntimeConfigOptions
5503
+ cypressConfig: PluginConfigOptions
5504
5504
  devServerEvents: NodeJS.EventEmitter
5505
5505
  }
5506
5506