cypress 10.11.0 → 11.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. package/angular/CHANGELOG.md +20 -0
  2. package/angular/README.md +2 -77
  3. package/angular/dist/index.d.ts +124 -1
  4. package/angular/dist/index.js +59 -59
  5. package/lib/cli.js +15 -1
  6. package/lib/tasks/download.js +3 -7
  7. package/lib/util.js +2 -2
  8. package/mount-utils/CHANGELOG.md +14 -0
  9. package/mount-utils/README.md +7 -24
  10. package/mount-utils/dist/index.d.ts +25 -39
  11. package/mount-utils/dist/index.js +33 -112
  12. package/mount-utils/package.json +1 -0
  13. package/package.json +3 -3
  14. package/react/CHANGELOG.md +27 -0
  15. package/react/README.md +2 -107
  16. package/react/dist/cypress-react.cjs.js +92 -219
  17. package/react/dist/cypress-react.esm-bundler.js +92 -220
  18. package/react/dist/index.d.ts +111 -4
  19. package/react18/CHANGELOG.md +13 -0
  20. package/react18/README.md +7 -0
  21. package/react18/dist/cypress-react.cjs.js +117 -180
  22. package/react18/dist/cypress-react.esm-bundler.js +103 -167
  23. package/react18/dist/index.d.ts +78 -6
  24. package/react18/package.json +1 -0
  25. package/svelte/CHANGELOG.md +20 -0
  26. package/svelte/README.md +1 -69
  27. package/svelte/dist/cypress-svelte.cjs.js +19 -114
  28. package/svelte/dist/cypress-svelte.esm-bundler.js +19 -114
  29. package/svelte/dist/index.d.ts +201 -1
  30. package/types/cypress.d.ts +18 -10
  31. package/vue/CHANGELOG.md +34 -0
  32. package/vue/README.md +2 -76
  33. package/vue/dist/cypress-vue.cjs.js +68 -151
  34. package/vue/dist/cypress-vue.esm-bundler.js +68 -151
  35. package/vue/dist/index.d.ts +1352 -104
  36. package/vue/package.json +1 -1
  37. package/vue2/CHANGELOG.md +27 -0
  38. package/vue2/README.md +2 -72
  39. package/vue2/dist/cypress-vue2.cjs.js +87 -211
  40. package/vue2/dist/cypress-vue2.esm-bundler.js +86 -210
  41. package/vue2/dist/index.d.ts +341 -172
  42. package/vue2/package.json +1 -3
  43. package/angular/dist/mount.d.ts +0 -112
  44. package/react/dist/createMount.d.ts +0 -31
  45. package/react/dist/getDisplayName.d.ts +0 -8
  46. package/react/dist/mount.d.ts +0 -8
  47. package/react/dist/mountHook.d.ts +0 -12
  48. package/react/dist/types.d.ts +0 -45
  49. package/svelte/dist/mount.d.ts +0 -30
  50. package/vue/dist/@vue/test-utils/baseWrapper.d.ts +0 -63
  51. package/vue/dist/@vue/test-utils/components/RouterLinkStub.d.ts +0 -21
  52. package/vue/dist/@vue/test-utils/config.d.ts +0 -30
  53. package/vue/dist/@vue/test-utils/constants/dom-events.d.ts +0 -900
  54. package/vue/dist/@vue/test-utils/createDomEvent.d.ts +0 -9
  55. package/vue/dist/@vue/test-utils/domWrapper.d.ts +0 -18
  56. package/vue/dist/@vue/test-utils/emit.d.ts +0 -5
  57. package/vue/dist/@vue/test-utils/errorWrapper.d.ts +0 -1
  58. package/vue/dist/@vue/test-utils/index.d.ts +0 -11
  59. package/vue/dist/@vue/test-utils/interfaces/wrapperLike.d.ts +0 -56
  60. package/vue/dist/@vue/test-utils/mount.d.ts +0 -35
  61. package/vue/dist/@vue/test-utils/stubs.d.ts +0 -22
  62. package/vue/dist/@vue/test-utils/types.d.ts +0 -125
  63. package/vue/dist/@vue/test-utils/utils/autoUnmount.d.ts +0 -5
  64. package/vue/dist/@vue/test-utils/utils/compileSlots.d.ts +0 -2
  65. package/vue/dist/@vue/test-utils/utils/componentName.d.ts +0 -4
  66. package/vue/dist/@vue/test-utils/utils/find.d.ts +0 -10
  67. package/vue/dist/@vue/test-utils/utils/flushPromises.d.ts +0 -1
  68. package/vue/dist/@vue/test-utils/utils/getRootNodes.d.ts +0 -2
  69. package/vue/dist/@vue/test-utils/utils/isElement.d.ts +0 -1
  70. package/vue/dist/@vue/test-utils/utils/isElementVisible.d.ts +0 -6
  71. package/vue/dist/@vue/test-utils/utils/matchName.d.ts +0 -1
  72. package/vue/dist/@vue/test-utils/utils/stringifyNode.d.ts +0 -1
  73. package/vue/dist/@vue/test-utils/utils/vueCompatSupport.d.ts +0 -8
  74. package/vue/dist/@vue/test-utils/utils/vueShared.d.ts +0 -3
  75. package/vue/dist/@vue/test-utils/utils.d.ts +0 -13
  76. package/vue/dist/@vue/test-utils/vueWrapper.d.ts +0 -35
  77. package/vue/dist/@vue/test-utils/wrapperFactory.d.ts +0 -14
@@ -5,7 +5,7 @@
5
5
  * Released under the MIT License
6
6
  */
7
7
 
8
- import require$$0$1 from 'vue';
8
+ import Vue from 'vue';
9
9
 
10
10
  var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
11
11
 
@@ -5729,15 +5729,11 @@ var build = /*#__PURE__*/Object.defineProperty({
5729
5729
  }, '__esModule', {value: true});
5730
5730
 
5731
5731
  try {
5732
- var vueVersion = require$$0$1.version;
5732
+ var vueVersion = Vue.version;
5733
5733
  } catch (e) {}
5734
5734
 
5735
5735
  var vueTemplateCompiler = build;
5736
5736
 
5737
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
5738
-
5739
- var Vue__default = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
5740
-
5741
5737
  //
5742
5738
 
5743
5739
  function createVNodes(vm, slotValue, name) {
@@ -5783,7 +5779,7 @@ function createSlotVNodes(
5783
5779
  }, [])
5784
5780
  }
5785
5781
 
5786
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof commonjsGlobal$1 !== 'undefined' ? commonjsGlobal$1 : typeof self !== 'undefined' ? self : {};
5782
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
5787
5783
 
5788
5784
  function createCommonjsModule(fn, basedir, module) {
5789
5785
  return module = {
@@ -7409,17 +7405,17 @@ var DOM_SELECTOR = 'DOM_SELECTOR';
7409
7405
  var INVALID_SELECTOR = 'INVALID_SELECTOR';
7410
7406
 
7411
7407
  var VUE_VERSION = Number(
7412
- ((Vue__default['default'].version.split('.')[0]) + "." + (Vue__default['default'].version.split('.')[1]))
7408
+ ((Vue.version.split('.')[0]) + "." + (Vue.version.split('.')[1]))
7413
7409
  );
7414
7410
 
7415
7411
  var FUNCTIONAL_OPTIONS =
7416
7412
  VUE_VERSION >= 2.5 ? 'fnOptions' : 'functionalOptions';
7417
7413
 
7418
- var BEFORE_RENDER_LIFECYCLE_HOOK = semver.gt(Vue__default['default'].version, '2.1.8')
7414
+ var BEFORE_RENDER_LIFECYCLE_HOOK = semver.gt(Vue.version, '2.1.8')
7419
7415
  ? 'beforeCreate'
7420
7416
  : 'beforeMount';
7421
7417
 
7422
- var CREATE_ELEMENT_ALIAS = semver.gt(Vue__default['default'].version, '2.1.5')
7418
+ var CREATE_ELEMENT_ALIAS = semver.gt(Vue.version, '2.1.5')
7423
7419
  ? '_c'
7424
7420
  : '_h';
7425
7421
 
@@ -7493,7 +7489,7 @@ var isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge;
7493
7489
 
7494
7490
  // get the event used to trigger v-model handler that updates bound data
7495
7491
  function getCheckedEvent() {
7496
- var version = Vue__default['default'].version;
7492
+ var version = Vue.version;
7497
7493
 
7498
7494
  if (semver.satisfies(version, '2.1.9 - 2.1.10')) {
7499
7495
  return 'click'
@@ -7513,9 +7509,9 @@ function getCheckedEvent() {
7513
7509
  * @return {Promise<R>}
7514
7510
  */
7515
7511
  function nextTick() {
7516
- if (VUE_VERSION > 2) { return Vue__default['default'].nextTick() }
7512
+ if (VUE_VERSION > 2) { return Vue.nextTick() }
7517
7513
  return new Promise(function (resolve) {
7518
- Vue__default['default'].nextTick(resolve);
7514
+ Vue.nextTick(resolve);
7519
7515
  })
7520
7516
  }
7521
7517
 
@@ -7559,7 +7555,7 @@ function addMocks(
7559
7555
  );
7560
7556
  }
7561
7557
  // $FlowIgnore
7562
- Vue__default['default'].util.defineReactive(_Vue, key, mockedProperties[key]);
7558
+ Vue.util.defineReactive(_Vue, key, mockedProperties[key]);
7563
7559
  });
7564
7560
  }
7565
7561
 
@@ -8060,8 +8056,8 @@ function createStubFromComponent(
8060
8056
  var tagName = (name || 'anonymous') + "-stub";
8061
8057
 
8062
8058
  // ignoreElements does not exist in Vue 2.0.x
8063
- if (Vue__default['default'].config.ignoredElements) {
8064
- Vue__default['default'].config.ignoredElements.push(tagName);
8059
+ if (Vue.config.ignoredElements) {
8060
+ Vue.config.ignoredElements.push(tagName);
8065
8061
  }
8066
8062
 
8067
8063
  return Object.assign({}, getCoreProperties(componentOptions),
@@ -14748,7 +14744,15 @@ ErrorWrapper.prototype.destroy = function destroy () {
14748
14744
  */
14749
14745
 
14750
14746
  function isStyleVisible(element) {
14751
- var ref = element.style;
14747
+ if (!(element instanceof HTMLElement) && !(element instanceof SVGElement)) {
14748
+ return false
14749
+ }
14750
+
14751
+ // Per https://lists.w3.org/Archives/Public/www-style/2018May/0031.html
14752
+ // getComputedStyle should only work with connected elements.
14753
+ var ref = element.isConnected
14754
+ ? getComputedStyle(element)
14755
+ : element.style;
14752
14756
  var display = ref.display;
14753
14757
  var visibility = ref.visibility;
14754
14758
  var opacity = ref.opacity;
@@ -17056,36 +17060,6 @@ var VueWrapper = /*@__PURE__*/(function (Wrapper) {
17056
17060
 
17057
17061
  //
17058
17062
 
17059
- var isEnabled = false;
17060
- var wrapperInstances = [];
17061
-
17062
- function enableAutoDestroy(hook) {
17063
- if (isEnabled) {
17064
- throwError('enableAutoDestroy cannot be called more than once');
17065
- }
17066
-
17067
- isEnabled = true;
17068
-
17069
- hook(function () {
17070
- wrapperInstances.forEach(function (wrapper) {
17071
- // skip child wrappers created by wrapper.find()
17072
- if (wrapper.vm || wrapper.isFunctionalComponent) {
17073
- wrapper.destroy();
17074
- }
17075
- });
17076
-
17077
- wrapperInstances.length = 0;
17078
- });
17079
- }
17080
-
17081
- function trackInstance(wrapper) {
17082
- if (!isEnabled) { return }
17083
-
17084
- wrapperInstances.push(wrapper);
17085
- }
17086
-
17087
- //
17088
-
17089
17063
  function createWrapper(
17090
17064
  node,
17091
17065
  options
@@ -17095,14 +17069,12 @@ function createWrapper(
17095
17069
  var componentInstance = node.child;
17096
17070
  if (componentInstance) {
17097
17071
  var wrapper$1 = new VueWrapper(componentInstance, options);
17098
- trackInstance(wrapper$1);
17099
17072
  return wrapper$1
17100
17073
  }
17101
17074
  var wrapper =
17102
- node instanceof Vue__default['default']
17075
+ node instanceof Vue
17103
17076
  ? new VueWrapper(node, options)
17104
17077
  : new Wrapper(node, options);
17105
- trackInstance(wrapper);
17106
17078
  return wrapper
17107
17079
  }
17108
17080
 
@@ -19601,7 +19573,7 @@ function _createLocalVue(
19601
19573
  _Vue,
19602
19574
  config
19603
19575
  ) {
19604
- if ( _Vue === void 0 ) _Vue = Vue__default['default'];
19576
+ if ( _Vue === void 0 ) _Vue = Vue;
19605
19577
  if ( config === void 0 ) config = {};
19606
19578
 
19607
19579
  var instance = _Vue.extend();
@@ -19623,14 +19595,14 @@ function _createLocalVue(
19623
19595
  });
19624
19596
 
19625
19597
  // config is not enumerable
19626
- instance.config = cloneDeep_1(Vue__default['default'].config);
19598
+ instance.config = cloneDeep_1(Vue.config);
19627
19599
 
19628
19600
  // if a user defined errorHandler is defined by a localVue instance via createLocalVue, register it
19629
19601
  instance.config.errorHandler = config.errorHandler;
19630
19602
 
19631
19603
  // option merge strategies need to be exposed by reference
19632
19604
  // so that merge strats registered by plugins can work properly
19633
- instance.config.optionMergeStrategies = Vue__default['default'].config.optionMergeStrategies;
19605
+ instance.config.optionMergeStrategies = Vue.config.optionMergeStrategies;
19634
19606
 
19635
19607
  // make sure all extends are based on this instance.
19636
19608
  // this is important so that global components registered by plugins,
@@ -19751,8 +19723,8 @@ function validateOptions(options, component) {
19751
19723
  }
19752
19724
  }
19753
19725
 
19754
- Vue__default['default'].config.productionTip = false;
19755
- Vue__default['default'].config.devtools = false;
19726
+ Vue.config.productionTip = false;
19727
+ Vue.config.devtools = false;
19756
19728
 
19757
19729
  function mount$1(component, options) {
19758
19730
  if ( options === void 0 ) options = {};
@@ -19761,7 +19733,7 @@ function mount$1(component, options) {
19761
19733
 
19762
19734
  polyfill();
19763
19735
 
19764
- addGlobalErrorHandler(Vue__default['default']);
19736
+ addGlobalErrorHandler(Vue);
19765
19737
 
19766
19738
  var _Vue = _createLocalVue(
19767
19739
  options.localVue,
@@ -19807,11 +19779,13 @@ function createLocalVue(config) {
19807
19779
 
19808
19780
  return _createLocalVue(undefined, config)
19809
19781
  }
19810
- var createLocalVue_1 = createLocalVue;
19811
- var enableAutoDestroy_1 = enableAutoDestroy;
19812
- var mount_1 = mount$1;
19813
19782
 
19814
19783
  const ROOT_SELECTOR = '[data-cy-root]';
19784
+ /**
19785
+ * Gets the root element used to mount the component.
19786
+ * @returns {HTMLElement} The root element
19787
+ * @throws {Error} If the root element is not found
19788
+ */
19815
19789
  const getContainerEl = () => {
19816
19790
  const el = document.querySelector(ROOT_SELECTOR);
19817
19791
  if (el) {
@@ -19819,122 +19793,19 @@ const getContainerEl = () => {
19819
19793
  }
19820
19794
  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.`);
19821
19795
  };
19822
- /**
19823
- * Remove any style or extra link elements from the iframe placeholder
19824
- * left from any previous test
19825
- *
19826
- */
19827
- function cleanupStyles() {
19828
- const styles = document.body.querySelectorAll('[data-cy=injected-style-tag]');
19829
- styles.forEach((styleElement) => {
19830
- if (styleElement.parentElement) {
19831
- styleElement.parentElement.removeChild(styleElement);
19832
- }
19833
- });
19834
- const links = document.body.querySelectorAll('[data-cy=injected-stylesheet]');
19835
- links.forEach((link) => {
19836
- if (link.parentElement) {
19837
- link.parentElement.removeChild(link);
19796
+ function checkForRemovedStyleOptions(mountingOptions) {
19797
+ for (const key of ['cssFile', 'cssFiles', 'style', 'styles', 'stylesheet', 'stylesheets']) {
19798
+ if (mountingOptions[key]) {
19799
+ Cypress.utils.throwErrByPath('mount.removed_style_mounting_options', key);
19838
19800
  }
19839
- });
19840
- }
19841
- /**
19842
- * Insert links to external style resources.
19843
- */
19844
- function insertStylesheets(stylesheets, document, el) {
19845
- stylesheets.forEach((href) => {
19846
- const link = document.createElement('link');
19847
- link.type = 'text/css';
19848
- link.rel = 'stylesheet';
19849
- link.href = href;
19850
- link.dataset.cy = 'injected-stylesheet';
19851
- document.body.insertBefore(link, el);
19852
- });
19853
- }
19854
- /**
19855
- * Inserts a single stylesheet element
19856
- */
19857
- function insertStyles(styles, document, el) {
19858
- styles.forEach((style) => {
19859
- const styleElement = document.createElement('style');
19860
- styleElement.dataset.cy = 'injected-style-tag';
19861
- styleElement.appendChild(document.createTextNode(style));
19862
- document.body.insertBefore(styleElement, el);
19863
- });
19864
- }
19865
- function insertSingleCssFile(cssFilename, document, el, log) {
19866
- return cy.readFile(cssFilename, { log }).then((css) => {
19867
- const style = document.createElement('style');
19868
- style.appendChild(document.createTextNode(css));
19869
- document.body.insertBefore(style, el);
19870
- });
19871
- }
19872
- /**
19873
- * Reads the given CSS file from local file system
19874
- * and adds the loaded style text as an element.
19875
- */
19876
- function insertLocalCssFiles(cssFilenames, document, el, log) {
19877
- return Cypress.Promise.mapSeries(cssFilenames, (cssFilename) => {
19878
- return insertSingleCssFile(cssFilename, document, el, log);
19879
- });
19801
+ }
19880
19802
  }
19881
19803
  /**
19882
- * Injects custom style text or CSS file or 3rd party style resources
19883
- * into the given document.
19804
+ * Utility function to register CT side effects and run cleanup code during the "test:before:run" Cypress hook
19805
+ * @param optionalCallback Callback to be called before the next test runs
19884
19806
  */
19885
- const injectStylesBeforeElement = (options, document, el) => {
19886
- if (!el)
19887
- return;
19888
- // first insert all stylesheets as Link elements
19889
- let stylesheets = [];
19890
- if (typeof options.stylesheet === 'string') {
19891
- stylesheets.push(options.stylesheet);
19892
- }
19893
- else if (Array.isArray(options.stylesheet)) {
19894
- stylesheets = stylesheets.concat(options.stylesheet);
19895
- }
19896
- if (typeof options.stylesheets === 'string') {
19897
- options.stylesheets = [options.stylesheets];
19898
- }
19899
- if (options.stylesheets) {
19900
- stylesheets = stylesheets.concat(options.stylesheets);
19901
- }
19902
- insertStylesheets(stylesheets, document, el);
19903
- // insert any styles as <style>...</style> elements
19904
- let styles = [];
19905
- if (typeof options.style === 'string') {
19906
- styles.push(options.style);
19907
- }
19908
- else if (Array.isArray(options.style)) {
19909
- styles = styles.concat(options.style);
19910
- }
19911
- if (typeof options.styles === 'string') {
19912
- styles.push(options.styles);
19913
- }
19914
- else if (Array.isArray(options.styles)) {
19915
- styles = styles.concat(options.styles);
19916
- }
19917
- insertStyles(styles, document, el);
19918
- // now load any css files by path and add their content
19919
- // as <style>...</style> elements
19920
- let cssFiles = [];
19921
- if (typeof options.cssFile === 'string') {
19922
- cssFiles.push(options.cssFile);
19923
- }
19924
- else if (Array.isArray(options.cssFile)) {
19925
- cssFiles = cssFiles.concat(options.cssFile);
19926
- }
19927
- if (typeof options.cssFiles === 'string') {
19928
- cssFiles.push(options.cssFiles);
19929
- }
19930
- else if (Array.isArray(options.cssFiles)) {
19931
- cssFiles = cssFiles.concat(options.cssFiles);
19932
- }
19933
- return insertLocalCssFiles(cssFiles, document, el, options.log);
19934
- };
19935
19807
  function setupHooks(optionalCallback) {
19936
- // Consumed by the framework "mount" libs. A user might register their own mount in the scaffolded 'commands.js'
19937
- // file that is imported by e2e and component support files by default. We don't want CT side effects to run when e2e
19808
+ // We don't want CT side effects to run when e2e
19938
19809
  // testing so we early return.
19939
19810
  // System test to verify CT side effects do not pollute e2e: system-tests/test/e2e_with_mount_import_spec.ts
19940
19811
  if (Cypress.testingType !== 'component') {
@@ -19949,10 +19820,10 @@ function setupHooks(optionalCallback) {
19949
19820
  // @ts-ignore
19950
19821
  Cypress.on('test:before:run', () => {
19951
19822
  optionalCallback === null || optionalCallback === void 0 ? void 0 : optionalCallback();
19952
- cleanupStyles();
19953
19823
  });
19954
19824
  }
19955
19825
 
19826
+ /// <reference types="cypress" />
19956
19827
  const defaultOptions = [
19957
19828
  'vue',
19958
19829
  'extensions',
@@ -20019,6 +19890,10 @@ const resetStoreVM = (Vue, { store }) => {
20019
19890
  });
20020
19891
  return store;
20021
19892
  };
19893
+ const cleanup = () => {
19894
+ var _a;
19895
+ (_a = Cypress.vueWrapper) === null || _a === void 0 ? void 0 : _a.destroy();
19896
+ };
20022
19897
  /**
20023
19898
  * Direct Vue errors to the top error handler
20024
19899
  * where they will fail Cypress test
@@ -20032,15 +19907,6 @@ function failTestOnVueError(err, vm, info) {
20032
19907
  throw err;
20033
19908
  });
20034
19909
  }
20035
- function registerAutoDestroy($destroy) {
20036
- Cypress.on('test:before:run', () => {
20037
- $destroy();
20038
- });
20039
- }
20040
- enableAutoDestroy_1(registerAutoDestroy);
20041
- const injectStyles = (options) => {
20042
- return injectStylesBeforeElement(options, document, getContainerEl());
20043
- };
20044
19910
  /**
20045
19911
  * Extract the component name from the object passed to mount
20046
19912
  * @param componentOptions the compoennt passed to mount
@@ -20063,18 +19929,25 @@ function getComponentDisplayName(componentOptions) {
20063
19929
  }
20064
19930
  /**
20065
19931
  * Mounts a Vue component inside Cypress browser.
20066
- * @param {object} component imported from Vue file
19932
+ * @param {VueComponent} component imported from Vue file
19933
+ * @param {MountOptionsArgument} optionsOrProps used to pass options to component being mounted
19934
+ * @returns {Cypress.Chainable<{wrapper: Wrapper<T>, component: T}
20067
19935
  * @example
20068
- * import Greeting from './Greeting.vue'
20069
- * import { mount } from '@cypress/vue2'
20070
- * it('works', () => {
20071
- * // pass props, additional extensions, etc
20072
- * mount(Greeting, { ... })
20073
- * // use any Cypress command to test the component
20074
- * cy.get('#greeting').should('be.visible')
20075
- * })
19936
+ * import { mount } from '@cypress/vue'
19937
+ * import { Stepper } from './Stepper.vue'
19938
+ *
19939
+ * it('mounts', () => {
19940
+ * cy.mount(Stepper)
19941
+ * cy.get('[data-cy=increment]').click()
19942
+ * cy.get('[data-cy=counter]').should('have.text', '1')
19943
+ * })
19944
+ * @see {@link https://on.cypress.io/mounting-vue} for more details.
19945
+ *
20076
19946
  */
20077
19947
  const mount = (component, optionsOrProps = {}) => {
19948
+ checkForRemovedStyleOptions(optionsOrProps);
19949
+ // Remove last mounted component if cy.mount is called more than once in a test
19950
+ cleanup();
20078
19951
  const options = Cypress._.pick(optionsOrProps, defaultOptions);
20079
19952
  const props = Cypress._.omit(optionsOrProps, defaultOptions);
20080
19953
  const componentName = getComponentDisplayName(component);
@@ -20082,26 +19955,9 @@ const mount = (component, optionsOrProps = {}) => {
20082
19955
  return cy
20083
19956
  .window({
20084
19957
  log: false,
20085
- })
20086
- .then(() => {
20087
- const { style, stylesheets, stylesheet, styles, cssFiles, cssFile } = optionsOrProps;
20088
- injectStyles({
20089
- style,
20090
- stylesheets,
20091
- stylesheet,
20092
- styles,
20093
- cssFiles,
20094
- cssFile,
20095
- });
20096
19958
  })
20097
19959
  .then((win) => {
20098
- if (optionsOrProps.log !== false) {
20099
- Cypress.log({
20100
- name: 'mount',
20101
- message: [message],
20102
- }).snapshot('mounted').end();
20103
- }
20104
- const localVue = createLocalVue_1();
19960
+ const localVue = createLocalVue();
20105
19961
  // @ts-ignore
20106
19962
  win.Vue = localVue;
20107
19963
  localVue.config.errorHandler = failTestOnVueError;
@@ -20127,9 +19983,23 @@ const mount = (component, optionsOrProps = {}) => {
20127
19983
  registerGlobalComponents(localVue, options);
20128
19984
  props.attachTo = componentNode;
20129
19985
  const wrapper = localVue.extend(component);
20130
- const VTUWrapper = mount_1(wrapper, Object.assign({ localVue }, props));
19986
+ const VTUWrapper = mount$1(wrapper, Object.assign({ localVue }, props));
20131
19987
  Cypress.vue = VTUWrapper.vm;
20132
19988
  Cypress.vueWrapper = VTUWrapper;
19989
+ return {
19990
+ wrapper: VTUWrapper,
19991
+ component: VTUWrapper.vm,
19992
+ };
19993
+ })
19994
+ .then(() => {
19995
+ if (optionsOrProps.log !== false) {
19996
+ return Vue.nextTick(() => {
19997
+ Cypress.log({
19998
+ name: 'mount',
19999
+ message: [message],
20000
+ });
20001
+ });
20002
+ }
20133
20003
  });
20134
20004
  };
20135
20005
  /**
@@ -20137,9 +20007,15 @@ const mount = (component, optionsOrProps = {}) => {
20137
20007
  * @example
20138
20008
  * import {mountCallback} from '@cypress/vue2'
20139
20009
  * beforeEach(mountVue(component, options))
20010
+ *
20011
+ * Removed as of Cypress 11.0.0.
20012
+ * @see https://on.cypress.io/migration-11-0-0-component-testing-updates
20140
20013
  */
20141
20014
  const mountCallback = (component, options) => {
20142
- return () => mount(component, options);
20015
+ return () => {
20016
+ // @ts-expect-error - undocumented API
20017
+ Cypress.utils.throwErrByPath('mount.mount_callback');
20018
+ };
20143
20019
  };
20144
20020
  // Side effects from "import { mount } from '@cypress/<my-framework>'" are annoying, we should avoid doing this
20145
20021
  // by creating an explicit function/import that the user can register in their 'component.js' support file,
@@ -20149,6 +20025,6 @@ const mountCallback = (component, options) => {
20149
20025
  // import { registerCT } from 'cypress/<my-framework>'
20150
20026
  // registerCT()
20151
20027
  // Note: This would be a breaking change
20152
- setupHooks();
20028
+ setupHooks(cleanup);
20153
20029
 
20154
20030
  export { mount, mountCallback };