cypress 13.16.1 → 14.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. package/angular/README.md +5 -0
  2. package/angular/angular/README.md +5 -0
  3. package/angular/angular/dist/index.d.ts +11 -2
  4. package/angular/angular/dist/index.js +944 -4
  5. package/angular/angular/package.json +16 -9
  6. package/angular/dist/index.d.ts +11 -2
  7. package/angular/dist/index.js +944 -4
  8. package/angular/package.json +16 -9
  9. package/lib/cli.js +1 -30
  10. package/lib/exec/spawn.js +17 -7
  11. package/mount-utils/dist/index.d.ts +0 -28
  12. package/mount-utils/dist/index.js +0 -27
  13. package/mount-utils/mount-utils/dist/index.d.ts +0 -28
  14. package/mount-utils/mount-utils/dist/index.js +0 -27
  15. package/package.json +5 -23
  16. package/react/README.md +5 -0
  17. package/react/dist/cypress-react.cjs.js +21 -676
  18. package/react/dist/cypress-react.esm-bundler.js +22 -676
  19. package/react/dist/index.d.ts +13 -30
  20. package/react/package.json +13 -15
  21. package/react/react/README.md +5 -0
  22. package/react/react/dist/cypress-react.cjs.js +21 -676
  23. package/react/react/dist/cypress-react.esm-bundler.js +22 -676
  24. package/react/react/dist/index.d.ts +13 -30
  25. package/react/react/package.json +13 -15
  26. package/svelte/README.md +6 -2
  27. package/svelte/dist/cypress-svelte.cjs.js +12 -12
  28. package/svelte/dist/cypress-svelte.esm-bundler.js +12 -12
  29. package/svelte/dist/index.d.ts +8 -179
  30. package/svelte/package.json +2 -2
  31. package/svelte/svelte/README.md +6 -2
  32. package/svelte/svelte/dist/cypress-svelte.cjs.js +12 -12
  33. package/svelte/svelte/dist/cypress-svelte.esm-bundler.js +12 -12
  34. package/svelte/svelte/dist/index.d.ts +8 -179
  35. package/svelte/svelte/package.json +2 -2
  36. package/types/cypress.d.ts +32 -49
  37. package/types/net-stubbing.d.ts +2 -7
  38. package/vue/dist/cypress-vue.cjs.js +380 -275
  39. package/vue/dist/cypress-vue.esm-bundler.js +382 -276
  40. package/vue/dist/index.d.ts +61 -78
  41. package/vue/package.json +2 -5
  42. package/vue/vue/dist/cypress-vue.cjs.js +380 -275
  43. package/vue/vue/dist/cypress-vue.esm-bundler.js +382 -276
  44. package/vue/vue/dist/index.d.ts +61 -78
  45. package/vue/vue/package.json +2 -5
  46. package/angular-signals/README.md +0 -11
  47. package/angular-signals/angular-signals/README.md +0 -11
  48. package/angular-signals/angular-signals/dist/index.d.ts +0 -136
  49. package/angular-signals/angular-signals/dist/index.js +0 -1861
  50. package/angular-signals/angular-signals/package.json +0 -74
  51. package/angular-signals/dist/index.d.ts +0 -136
  52. package/angular-signals/dist/index.js +0 -1861
  53. package/angular-signals/package.json +0 -74
  54. package/react18/README.md +0 -7
  55. package/react18/dist/cypress-react.cjs.js +0 -597
  56. package/react18/dist/cypress-react.esm-bundler.js +0 -574
  57. package/react18/dist/index.d.ts +0 -78
  58. package/react18/package.json +0 -71
  59. package/react18/react18/README.md +0 -7
  60. package/react18/react18/dist/cypress-react.cjs.js +0 -597
  61. package/react18/react18/dist/cypress-react.esm-bundler.js +0 -574
  62. package/react18/react18/dist/index.d.ts +0 -78
  63. package/react18/react18/package.json +0 -71
  64. package/vue2/README.md +0 -7
  65. package/vue2/dist/cypress-vue2.cjs.js +0 -20045
  66. package/vue2/dist/cypress-vue2.esm-bundler.js +0 -20042
  67. package/vue2/dist/index.d.ts +0 -207
  68. package/vue2/package.json +0 -65
  69. package/vue2/vue2/README.md +0 -7
  70. package/vue2/vue2/dist/cypress-vue2.cjs.js +0 -20045
  71. package/vue2/vue2/dist/cypress-vue2.esm-bundler.js +0 -20042
  72. package/vue2/vue2/dist/index.d.ts +0 -207
  73. package/vue2/vue2/package.json +0 -65
@@ -1,12 +1,12 @@
1
1
 
2
2
  /**
3
3
  * @cypress/vue v0.0.0-development
4
- * (c) 2024 Cypress.io
4
+ * (c) 2025 Cypress.io
5
5
  * Released under the MIT License
6
6
  */
7
7
 
8
8
  import * as Vue from 'vue';
9
- import { nextTick, defineComponent, computed, h, shallowReactive, reactive, isRef, ref, createApp, transformVNodeArgs, setDevtoolsHook, Transition, BaseTransition, TransitionGroup } from 'vue';
9
+ import { nextTick, defineComponent, computed, h, shallowReactive, reactive, ref, createApp, transformVNodeArgs, setDevtoolsHook, Transition, BaseTransition, TransitionGroup, isRef } from 'vue';
10
10
  import { compile } from '@vue/compiler-dom';
11
11
  import { renderToString as renderToString$1 } from '@vue/server-renderer';
12
12
 
@@ -24,8 +24,6 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
24
24
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
25
25
  PERFORMANCE OF THIS SOFTWARE.
26
26
  ***************************************************************************** */
27
- /* global Reflect, Promise, SuppressedError, Symbol */
28
-
29
27
 
30
28
  function __rest(s, e) {
31
29
  var t = {};
@@ -57,13 +55,6 @@ const getContainerEl = () => {
57
55
  }
58
56
  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.`);
59
57
  };
60
- function checkForRemovedStyleOptions(mountingOptions) {
61
- for (const key of ['cssFile', 'cssFiles', 'style', 'styles', 'stylesheet', 'stylesheets']) {
62
- if (mountingOptions[key]) {
63
- Cypress.utils.throwErrByPath('mount.removed_style_mounting_options', key);
64
- }
65
- }
66
- }
67
58
  /**
68
59
  * Utility function to register CT side effects and run cleanup code during the "test:before:run" Cypress hook
69
60
  * @param optionalCallback Callback to be called before the next test runs
@@ -107,7 +98,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
107
98
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
108
99
  PERFORMANCE OF THIS SOFTWARE.
109
100
  ***************************************************************************** */
110
- /* global Reflect, Promise */
101
+ /* global Reflect, Promise, SuppressedError, Symbol */
111
102
 
112
103
  var extendStatics = function(d, b) {
113
104
  extendStatics = Object.setPrototypeOf ||
@@ -181,7 +172,12 @@ function __spreadArray(to, from, pack) {
181
172
  }
182
173
  }
183
174
  return to.concat(ar || Array.prototype.slice.call(from));
184
- }
175
+ }
176
+
177
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
178
+ var e = new Error(message);
179
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
180
+ };
185
181
 
186
182
  var Pluggable = /** @class */ (function () {
187
183
  function Pluggable() {
@@ -281,12 +277,30 @@ function mergeGlobalProperties(mountGlobal) {
281
277
  var isObject = function (obj) {
282
278
  return !!obj && typeof obj === 'object';
283
279
  };
280
+ function isClass(obj) {
281
+ if (!(obj instanceof Object))
282
+ return;
283
+ var isCtorClass = obj.constructor && obj.constructor.toString().substring(0, 5) === 'class';
284
+ if (!('prototype' in obj)) {
285
+ return isCtorClass;
286
+ }
287
+ var prototype = obj.prototype;
288
+ var isPrototypeCtorClass = prototype.constructor &&
289
+ prototype.constructor.toString &&
290
+ prototype.constructor.toString().substring(0, 5) === 'class';
291
+ return isCtorClass || isPrototypeCtorClass;
292
+ }
284
293
  // https://stackoverflow.com/a/48218209
285
294
  var mergeDeep = function (target, source) {
295
+ var _a;
286
296
  if (!isObject(target) || !isObject(source)) {
287
297
  return source;
288
298
  }
289
- Object.keys(source).forEach(function (key) {
299
+ Object.keys(source)
300
+ .concat(isClass(source)
301
+ ? Object.getOwnPropertyNames((_a = Object.getPrototypeOf(source)) !== null && _a !== void 0 ? _a : {})
302
+ : Object.getOwnPropertyNames(source))
303
+ .forEach(function (key) {
290
304
  var targetValue = target[key];
291
305
  var sourceValue = source[key];
292
306
  if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {
@@ -371,6 +385,20 @@ function hasSetupState(vm) {
371
385
  function isScriptSetup(vm) {
372
386
  return (vm && vm.$.setupState.__isScriptSetup);
373
387
  }
388
+ var _globalThis;
389
+ var getGlobalThis = function () {
390
+ return (_globalThis ||
391
+ (_globalThis =
392
+ typeof globalThis !== 'undefined'
393
+ ? globalThis
394
+ : typeof self !== 'undefined'
395
+ ? self
396
+ : typeof window !== 'undefined'
397
+ ? window
398
+ : typeof global !== 'undefined'
399
+ ? global
400
+ : {}));
401
+ };
374
402
 
375
403
  var ignorableKeyModifiers = [
376
404
  'stop',
@@ -1655,19 +1683,15 @@ function stringifyNode(node) {
1655
1683
  : new XMLSerializer().serializeToString(node);
1656
1684
  }
1657
1685
 
1658
- var jsExports = {};
1659
- var js = {
1660
- get exports(){ return jsExports; },
1661
- set exports(v){ jsExports = v; },
1662
- };
1686
+ function getDefaultExportFromCjs (x) {
1687
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1688
+ }
1689
+
1690
+ var js = {exports: {}};
1663
1691
 
1664
1692
  var src = {};
1665
1693
 
1666
- var javascriptExports = {};
1667
- var javascript = {
1668
- get exports(){ return javascriptExports; },
1669
- set exports(v){ javascriptExports = v; },
1670
- };
1694
+ var javascript = {exports: {}};
1671
1695
 
1672
1696
  var beautifier$2 = {};
1673
1697
 
@@ -2159,8 +2183,8 @@ function requireAcorn () {
2159
2183
  // in javascript, these two differ
2160
2184
  // in python they are the same, different methods are called on them
2161
2185
  exports.lineBreak = new RegExp('\r\n|' + exports.newline.source);
2162
- exports.allLineBreaks = new RegExp(exports.lineBreak.source, 'g');
2163
- } (acorn));
2186
+ exports.allLineBreaks = new RegExp(exports.lineBreak.source, 'g');
2187
+ } (acorn));
2164
2188
  return acorn;
2165
2189
  }
2166
2190
 
@@ -3328,6 +3352,7 @@ function requireTokenizer$1 () {
3328
3352
 
3329
3353
  token = token || this._read_non_javascript(c);
3330
3354
  token = token || this._read_string(c);
3355
+ token = token || this._read_pair(c, this._input.peek(1)); // Issue #2062 hack for record type '#{'
3331
3356
  token = token || this._read_word(previous_token);
3332
3357
  token = token || this._read_singles(c);
3333
3358
  token = token || this._read_comment(c);
@@ -3386,6 +3411,19 @@ function requireTokenizer$1 () {
3386
3411
  return token;
3387
3412
  };
3388
3413
 
3414
+ Tokenizer.prototype._read_pair = function(c, d) {
3415
+ var token = null;
3416
+ if (c === '#' && d === '{') {
3417
+ token = this._create_token(TOKEN.START_BLOCK, c + d);
3418
+ }
3419
+
3420
+ if (token) {
3421
+ this._input.next();
3422
+ this._input.next();
3423
+ }
3424
+ return token;
3425
+ };
3426
+
3389
3427
  Tokenizer.prototype._read_punctuation = function() {
3390
3428
  var resulting_string = this.__patterns.punct.read();
3391
3429
 
@@ -4472,7 +4510,7 @@ function requireBeautifier$2 () {
4472
4510
  }
4473
4511
  }
4474
4512
  if (this._flags.last_token.type !== TOKEN.OPERATOR && this._flags.last_token.type !== TOKEN.START_EXPR) {
4475
- if (this._flags.last_token.type === TOKEN.START_BLOCK && !this._flags.inline_frame) {
4513
+ if (in_array(this._flags.last_token.type, [TOKEN.START_BLOCK, TOKEN.SEMICOLON]) && !this._flags.inline_frame) {
4476
4514
  this.print_newline();
4477
4515
  } else {
4478
4516
  this._output.space_before_token = true;
@@ -5175,7 +5213,7 @@ function requireBeautifier$2 () {
5175
5213
  var hasRequiredJavascript;
5176
5214
 
5177
5215
  function requireJavascript () {
5178
- if (hasRequiredJavascript) return javascriptExports;
5216
+ if (hasRequiredJavascript) return javascript.exports;
5179
5217
  hasRequiredJavascript = 1;
5180
5218
 
5181
5219
  var Beautifier = requireBeautifier$2().Beautifier,
@@ -5187,17 +5225,13 @@ function requireJavascript () {
5187
5225
  }
5188
5226
 
5189
5227
  javascript.exports = js_beautify;
5190
- javascriptExports.defaultOptions = function() {
5228
+ javascript.exports.defaultOptions = function() {
5191
5229
  return new Options();
5192
5230
  };
5193
- return javascriptExports;
5231
+ return javascript.exports;
5194
5232
  }
5195
5233
 
5196
- var cssExports = {};
5197
- var css = {
5198
- get exports(){ return cssExports; },
5199
- set exports(v){ cssExports = v; },
5200
- };
5234
+ var css = {exports: {}};
5201
5235
 
5202
5236
  var beautifier$1 = {};
5203
5237
 
@@ -5274,18 +5308,18 @@ function requireBeautifier$1 () {
5274
5308
 
5275
5309
  // https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule
5276
5310
  this.NESTED_AT_RULE = {
5277
- "@page": true,
5278
- "@font-face": true,
5279
- "@keyframes": true,
5311
+ "page": true,
5312
+ "font-face": true,
5313
+ "keyframes": true,
5280
5314
  // also in CONDITIONAL_GROUP_RULE below
5281
- "@media": true,
5282
- "@supports": true,
5283
- "@document": true
5315
+ "media": true,
5316
+ "supports": true,
5317
+ "document": true
5284
5318
  };
5285
5319
  this.CONDITIONAL_GROUP_RULE = {
5286
- "@media": true,
5287
- "@supports": true,
5288
- "@document": true
5320
+ "media": true,
5321
+ "supports": true,
5322
+ "document": true
5289
5323
  };
5290
5324
  this.NON_SEMICOLON_NEWLINE_PROPERTY = [
5291
5325
  "grid-template-areas",
@@ -5413,8 +5447,7 @@ function requireBeautifier$1 () {
5413
5447
  // label { content: blue }
5414
5448
  var insidePropertyValue = false;
5415
5449
  var enteringConditionalGroup = false;
5416
- var insideAtExtend = false;
5417
- var insideAtImport = false;
5450
+ var insideNonNestedAtRule = false;
5418
5451
  var insideScssMap = false;
5419
5452
  var topCharacter = this._ch;
5420
5453
  var insideNonSemiColonValues = false;
@@ -5469,10 +5502,32 @@ function requireBeautifier$1 () {
5469
5502
 
5470
5503
  // Ensures any new lines following the comment are preserved
5471
5504
  this.eatWhitespace(true);
5472
- } else if (this._ch === '@' || this._ch === '$') {
5505
+ } else if (this._ch === '$') {
5506
+ this.preserveSingleSpace(isAfterSpace);
5507
+
5508
+ this.print_string(this._ch);
5509
+
5510
+ // strip trailing space, if present, for hash property checks
5511
+ var variable = this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);
5512
+
5513
+ if (variable.match(/[ :]$/)) {
5514
+ // we have a variable or pseudo-class, add it and insert one space before continuing
5515
+ variable = this.eatString(": ").replace(/\s$/, '');
5516
+ this.print_string(variable);
5517
+ this._output.space_before_token = true;
5518
+ }
5519
+
5520
+ variable = variable.replace(/\s$/, '');
5521
+
5522
+ // might be sass variable
5523
+ if (parenLevel === 0 && variable.indexOf(':') !== -1) {
5524
+ insidePropertyValue = true;
5525
+ this.indent();
5526
+ }
5527
+ } else if (this._ch === '@') {
5473
5528
  this.preserveSingleSpace(isAfterSpace);
5474
5529
 
5475
- // deal with less propery mixins @{...}
5530
+ // deal with less property mixins @{...}
5476
5531
  if (this._input.peek() === '{') {
5477
5532
  this.print_string(this._ch + this.eatString('}'));
5478
5533
  } else {
@@ -5490,22 +5545,21 @@ function requireBeautifier$1 () {
5490
5545
 
5491
5546
  variableOrRule = variableOrRule.replace(/\s$/, '');
5492
5547
 
5493
- if (variableOrRule === 'extend') {
5494
- insideAtExtend = true;
5495
- } else if (variableOrRule === 'import') {
5496
- insideAtImport = true;
5497
- }
5548
+ // might be less variable
5549
+ if (parenLevel === 0 && variableOrRule.indexOf(':') !== -1) {
5550
+ insidePropertyValue = true;
5551
+ this.indent();
5498
5552
 
5499
- // might be a nesting at-rule
5500
- if (variableOrRule in this.NESTED_AT_RULE) {
5553
+ // might be a nesting at-rule
5554
+ } else if (variableOrRule in this.NESTED_AT_RULE) {
5501
5555
  this._nestedLevel += 1;
5502
5556
  if (variableOrRule in this.CONDITIONAL_GROUP_RULE) {
5503
5557
  enteringConditionalGroup = true;
5504
5558
  }
5505
- // might be less variable
5506
- } else if (!insideRule && parenLevel === 0 && variableOrRule.indexOf(':') !== -1) {
5507
- insidePropertyValue = true;
5508
- this.indent();
5559
+
5560
+ // might be a non-nested at-rule
5561
+ } else if (parenLevel === 0 && !insidePropertyValue) {
5562
+ insideNonNestedAtRule = true;
5509
5563
  }
5510
5564
  }
5511
5565
  } else if (this._ch === '#' && this._input.peek() === '{') {
@@ -5517,6 +5571,9 @@ function requireBeautifier$1 () {
5517
5571
  this.outdent();
5518
5572
  }
5519
5573
 
5574
+ // non nested at rule becomes nested
5575
+ insideNonNestedAtRule = false;
5576
+
5520
5577
  // when entering conditional groups, only rulesets are allowed
5521
5578
  if (enteringConditionalGroup) {
5522
5579
  enteringConditionalGroup = false;
@@ -5557,8 +5614,7 @@ function requireBeautifier$1 () {
5557
5614
  if (previous_ch === '{') {
5558
5615
  this._output.trim(true);
5559
5616
  }
5560
- insideAtImport = false;
5561
- insideAtExtend = false;
5617
+
5562
5618
  if (insidePropertyValue) {
5563
5619
  this.outdent();
5564
5620
  insidePropertyValue = false;
@@ -5592,9 +5648,10 @@ function requireBeautifier$1 () {
5592
5648
  }
5593
5649
  }
5594
5650
 
5595
- if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !insideAtExtend && parenLevel === 0) {
5651
+ if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !insideNonNestedAtRule && parenLevel === 0) {
5596
5652
  // 'property: value' delimiter
5597
5653
  // which could be in a conditional group query
5654
+
5598
5655
  this.print_string(':');
5599
5656
  if (!insidePropertyValue) {
5600
5657
  insidePropertyValue = true;
@@ -5631,8 +5688,7 @@ function requireBeautifier$1 () {
5631
5688
  this.outdent();
5632
5689
  insidePropertyValue = false;
5633
5690
  }
5634
- insideAtExtend = false;
5635
- insideAtImport = false;
5691
+ insideNonNestedAtRule = false;
5636
5692
  this.print_string(this._ch);
5637
5693
  this.eatWhitespace(true);
5638
5694
 
@@ -5697,7 +5753,7 @@ function requireBeautifier$1 () {
5697
5753
  } else if (this._ch === ',') {
5698
5754
  this.print_string(this._ch);
5699
5755
  this.eatWhitespace(true);
5700
- if (this._options.selector_separator_newline && (!insidePropertyValue || insideScssMap) && parenLevel === 0 && !insideAtImport && !insideAtExtend) {
5756
+ if (this._options.selector_separator_newline && (!insidePropertyValue || insideScssMap) && parenLevel === 0 && !insideNonNestedAtRule) {
5701
5757
  this._output.add_new_line();
5702
5758
  } else {
5703
5759
  this._output.space_before_token = true;
@@ -5755,7 +5811,7 @@ function requireBeautifier$1 () {
5755
5811
  var hasRequiredCss;
5756
5812
 
5757
5813
  function requireCss () {
5758
- if (hasRequiredCss) return cssExports;
5814
+ if (hasRequiredCss) return css.exports;
5759
5815
  hasRequiredCss = 1;
5760
5816
 
5761
5817
  var Beautifier = requireBeautifier$1().Beautifier,
@@ -5767,17 +5823,13 @@ function requireCss () {
5767
5823
  }
5768
5824
 
5769
5825
  css.exports = css_beautify;
5770
- cssExports.defaultOptions = function() {
5826
+ css.exports.defaultOptions = function() {
5771
5827
  return new Options();
5772
5828
  };
5773
- return cssExports;
5829
+ return css.exports;
5774
5830
  }
5775
5831
 
5776
- var htmlExports = {};
5777
- var html = {
5778
- get exports(){ return htmlExports; },
5779
- set exports(v){ htmlExports = v; },
5780
- };
5832
+ var html = {exports: {}};
5781
5833
 
5782
5834
  var beautifier = {};
5783
5835
 
@@ -5806,6 +5858,7 @@ function requireOptions () {
5806
5858
  this.indent_handlebars = this._get_boolean('indent_handlebars', true);
5807
5859
  this.wrap_attributes = this._get_selection('wrap_attributes',
5808
5860
  ['auto', 'force', 'force-aligned', 'force-expand-multiline', 'aligned-multiple', 'preserve', 'preserve-aligned']);
5861
+ this.wrap_attributes_min_attrs = this._get_number('wrap_attributes_min_attrs', 2);
5809
5862
  this.wrap_attributes_indent_size = this._get_number('wrap_attributes_indent_size', this.indent_size);
5810
5863
  this.extra_liners = this._get_array('extra_liners', ['head', 'body', '/html']);
5811
5864
 
@@ -5823,6 +5876,7 @@ function requireOptions () {
5823
5876
  // obsolete inline tags
5824
5877
  'acronym', 'big', 'strike', 'tt'
5825
5878
  ]);
5879
+ this.inline_custom_elements = this._get_boolean('inline_custom_elements', true);
5826
5880
  this.void_elements = this._get_array('void_elements', [
5827
5881
  // HTLM void elements - aka self-closing tags - aka singletons
5828
5882
  // https://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements
@@ -6446,11 +6500,11 @@ function requireBeautifier () {
6446
6500
  while (raw_token.type !== TOKEN.EOF) {
6447
6501
 
6448
6502
  if (raw_token.type === TOKEN.TAG_OPEN || raw_token.type === TOKEN.COMMENT) {
6449
- parser_token = this._handle_tag_open(printer, raw_token, last_tag_token, last_token);
6503
+ parser_token = this._handle_tag_open(printer, raw_token, last_tag_token, last_token, tokens);
6450
6504
  last_tag_token = parser_token;
6451
6505
  } else if ((raw_token.type === TOKEN.ATTRIBUTE || raw_token.type === TOKEN.EQUALS || raw_token.type === TOKEN.VALUE) ||
6452
6506
  (raw_token.type === TOKEN.TEXT && !last_tag_token.tag_complete)) {
6453
- parser_token = this._handle_inside_tag(printer, raw_token, last_tag_token, tokens);
6507
+ parser_token = this._handle_inside_tag(printer, raw_token, last_tag_token, last_token);
6454
6508
  } else if (raw_token.type === TOKEN.TAG_CLOSE) {
6455
6509
  parser_token = this._handle_tag_close(printer, raw_token, last_tag_token);
6456
6510
  } else if (raw_token.type === TOKEN.TEXT) {
@@ -6507,7 +6561,7 @@ function requireBeautifier () {
6507
6561
  return parser_token;
6508
6562
  };
6509
6563
 
6510
- Beautifier.prototype._handle_inside_tag = function(printer, raw_token, last_tag_token, tokens) {
6564
+ Beautifier.prototype._handle_inside_tag = function(printer, raw_token, last_tag_token, last_token) {
6511
6565
  var wrapped = last_tag_token.has_wrapped_attrs;
6512
6566
  var parser_token = {
6513
6567
  text: raw_token.text,
@@ -6528,7 +6582,6 @@ function requireBeautifier () {
6528
6582
  } else {
6529
6583
  if (raw_token.type === TOKEN.ATTRIBUTE) {
6530
6584
  printer.set_space_before_token(true);
6531
- last_tag_token.attr_count += 1;
6532
6585
  } else if (raw_token.type === TOKEN.EQUALS) { //no space before =
6533
6586
  printer.set_space_before_token(false);
6534
6587
  } else if (raw_token.type === TOKEN.VALUE && raw_token.previous.type === TOKEN.EQUALS) { //no space before value
@@ -6541,29 +6594,15 @@ function requireBeautifier () {
6541
6594
  wrapped = wrapped || raw_token.newlines !== 0;
6542
6595
  }
6543
6596
 
6544
-
6545
- if (this._is_wrap_attributes_force) {
6546
- var force_attr_wrap = last_tag_token.attr_count > 1;
6547
- if (this._is_wrap_attributes_force_expand_multiline && last_tag_token.attr_count === 1) {
6548
- var is_only_attribute = true;
6549
- var peek_index = 0;
6550
- var peek_token;
6551
- do {
6552
- peek_token = tokens.peek(peek_index);
6553
- if (peek_token.type === TOKEN.ATTRIBUTE) {
6554
- is_only_attribute = false;
6555
- break;
6556
- }
6557
- peek_index += 1;
6558
- } while (peek_index < 4 && peek_token.type !== TOKEN.EOF && peek_token.type !== TOKEN.TAG_CLOSE);
6559
-
6560
- force_attr_wrap = !is_only_attribute;
6561
- }
6562
-
6563
- if (force_attr_wrap) {
6564
- printer.print_newline(false);
6565
- wrapped = true;
6566
- }
6597
+ // Wrap for 'force' options, and if the number of attributes is at least that specified in 'wrap_attributes_min_attrs':
6598
+ // 1. always wrap the second and beyond attributes
6599
+ // 2. wrap the first attribute only if 'force-expand-multiline' is specified
6600
+ if (this._is_wrap_attributes_force &&
6601
+ last_tag_token.attr_count >= this._options.wrap_attributes_min_attrs &&
6602
+ (last_token.type !== TOKEN.TAG_OPEN || // ie. second attribute and beyond
6603
+ this._is_wrap_attributes_force_expand_multiline)) {
6604
+ printer.print_newline(false);
6605
+ wrapped = true;
6567
6606
  }
6568
6607
  }
6569
6608
  printer.print_token(raw_token);
@@ -6692,12 +6731,12 @@ function requireBeautifier () {
6692
6731
  }
6693
6732
  };
6694
6733
 
6695
- Beautifier.prototype._handle_tag_open = function(printer, raw_token, last_tag_token, last_token) {
6734
+ Beautifier.prototype._handle_tag_open = function(printer, raw_token, last_tag_token, last_token, tokens) {
6696
6735
  var parser_token = this._get_tag_open_token(raw_token);
6697
6736
 
6698
6737
  if ((last_tag_token.is_unformatted || last_tag_token.is_content_unformatted) &&
6699
6738
  !last_tag_token.is_empty_element &&
6700
- raw_token.type === TOKEN.TAG_OPEN && raw_token.text.indexOf('</') === 0) {
6739
+ raw_token.type === TOKEN.TAG_OPEN && !parser_token.is_start_tag) {
6701
6740
  // End element tags for unformatted or content_unformatted elements
6702
6741
  // are printed raw to keep any newlines inside them exactly the same.
6703
6742
  printer.add_raw_token(raw_token);
@@ -6711,6 +6750,19 @@ function requireBeautifier () {
6711
6750
  printer.print_token(raw_token);
6712
6751
  }
6713
6752
 
6753
+ // count the number of attributes
6754
+ if (parser_token.is_start_tag && this._is_wrap_attributes_force) {
6755
+ var peek_index = 0;
6756
+ var peek_token;
6757
+ do {
6758
+ peek_token = tokens.peek(peek_index);
6759
+ if (peek_token.type === TOKEN.ATTRIBUTE) {
6760
+ parser_token.attr_count += 1;
6761
+ }
6762
+ peek_index += 1;
6763
+ } while (peek_token.type !== TOKEN.EOF && peek_token.type !== TOKEN.TAG_CLOSE);
6764
+ }
6765
+
6714
6766
  //indent attributes an auto, forced, aligned or forced-align line-wrap
6715
6767
  if (this._is_wrap_attributes_force_aligned || this._is_wrap_attributes_aligned_multiple || this._is_wrap_attributes_preserve_aligned) {
6716
6768
  parser_token.alignment_size = raw_token.text.length + 1;
@@ -6808,7 +6860,7 @@ function requireBeautifier () {
6808
6860
 
6809
6861
  parser_token.is_unformatted = !parser_token.tag_complete && in_array(parser_token.tag_check, this._options.unformatted);
6810
6862
  parser_token.is_content_unformatted = !parser_token.is_empty_element && in_array(parser_token.tag_check, this._options.content_unformatted);
6811
- parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || parser_token.tag_start_char === '{';
6863
+ parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || (this._options.inline_custom_elements && parser_token.tag_name.includes("-")) || parser_token.tag_start_char === '{';
6812
6864
 
6813
6865
  return parser_token;
6814
6866
  };
@@ -6913,7 +6965,7 @@ function requireBeautifier () {
6913
6965
  };
6914
6966
 
6915
6967
  //To be used for <p> tag special case:
6916
- var p_closers = ['address', 'article', 'aside', 'blockquote', 'details', 'div', 'dl', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'main', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul'];
6968
+ var p_closers = ['address', 'article', 'aside', 'blockquote', 'details', 'div', 'dl', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hr', 'main', 'menu', 'nav', 'ol', 'p', 'pre', 'section', 'table', 'ul'];
6917
6969
  var p_parent_excludes = ['a', 'audio', 'del', 'ins', 'map', 'noscript', 'video'];
6918
6970
 
6919
6971
  Beautifier.prototype._do_optional_end_element = function(parser_token) {
@@ -6936,7 +6988,7 @@ function requireBeautifier () {
6936
6988
 
6937
6989
  } else if (parser_token.tag_name === 'li') {
6938
6990
  // An li element’s end tag may be omitted if the li element is immediately followed by another li element or if there is no more content in the parent element.
6939
- result = result || this._tag_stack.try_pop('li', ['ol', 'ul']);
6991
+ result = result || this._tag_stack.try_pop('li', ['ol', 'ul', 'menu']);
6940
6992
 
6941
6993
  } else if (parser_token.tag_name === 'dd' || parser_token.tag_name === 'dt') {
6942
6994
  // A dd element’s end tag may be omitted if the dd element is immediately followed by another dd element or a dt element, or if there is no more content in the parent element.
@@ -7032,7 +7084,7 @@ function requireBeautifier () {
7032
7084
  var hasRequiredHtml;
7033
7085
 
7034
7086
  function requireHtml () {
7035
- if (hasRequiredHtml) return htmlExports;
7087
+ if (hasRequiredHtml) return html.exports;
7036
7088
  hasRequiredHtml = 1;
7037
7089
 
7038
7090
  var Beautifier = requireBeautifier().Beautifier,
@@ -7044,10 +7096,10 @@ function requireHtml () {
7044
7096
  }
7045
7097
 
7046
7098
  html.exports = style_html;
7047
- htmlExports.defaultOptions = function() {
7099
+ html.exports.defaultOptions = function() {
7048
7100
  return new Options();
7049
7101
  };
7050
- return htmlExports;
7102
+ return html.exports;
7051
7103
  }
7052
7104
 
7053
7105
  /*jshint node:true */
@@ -7124,10 +7176,11 @@ function requireSrc () {
7124
7176
  mod.exports = get_beautify(beautifier, beautifier, beautifier);
7125
7177
 
7126
7178
  })(module);
7127
- }
7179
+ }
7128
7180
  } (js));
7129
7181
 
7130
- var beautify = jsExports;
7182
+ var jsExports = js.exports;
7183
+ var beautify = /*@__PURE__*/getDefaultExportFromCjs(jsExports);
7131
7184
 
7132
7185
  var BaseWrapper = /** @class */ (function () {
7133
7186
  function BaseWrapper(element) {
@@ -7212,7 +7265,9 @@ var BaseWrapper = /** @class */ (function () {
7212
7265
  }
7213
7266
  if (matches(currentComponent.vnode, selector) &&
7214
7267
  this.element.contains(currentComponent.vnode.el)) {
7215
- return createVueWrapper(null, currentComponent.proxy);
7268
+ return createVueWrapper(null, currentComponent.subTree.component
7269
+ ? currentComponent.subTree.component.proxy
7270
+ : currentComponent.proxy);
7216
7271
  }
7217
7272
  var result = this.findAllComponents(selector)[0];
7218
7273
  return result !== null && result !== void 0 ? result : createWrapperError('VueWrapper');
@@ -7238,7 +7293,9 @@ var BaseWrapper = /** @class */ (function () {
7238
7293
  return beautify.html(node, {
7239
7294
  unformatted: ['code', 'pre', 'em', 'strong', 'span'],
7240
7295
  indent_inner_html: true,
7241
- indent_size: 2
7296
+ indent_size: 2,
7297
+ inline_custom_elements: false
7298
+ // TODO the cast can be removed when @types/js-beautify will be up-to-date
7242
7299
  });
7243
7300
  })
7244
7301
  .join('\n');
@@ -7263,7 +7320,7 @@ var BaseWrapper = /** @class */ (function () {
7263
7320
  return key ? attributeMap[key] : attributeMap;
7264
7321
  };
7265
7322
  BaseWrapper.prototype.text = function () {
7266
- return textContent(this.element);
7323
+ return this.getRootNodes().map(textContent).join('');
7267
7324
  };
7268
7325
  BaseWrapper.prototype.exists = function () {
7269
7326
  return true;
@@ -7369,10 +7426,10 @@ var DOMWrapper = /** @class */ (function (_super) {
7369
7426
  var results = _super.prototype.findAllComponents.call(this, selector);
7370
7427
  return results.filter(function (r) { return _this.element.contains(r.element); });
7371
7428
  };
7372
- DOMWrapper.prototype.setChecked = function (checked) {
7373
- if (checked === void 0) { checked = true; }
7374
- return __awaiter(this, void 0, void 0, function () {
7429
+ DOMWrapper.prototype.setChecked = function () {
7430
+ return __awaiter(this, arguments, void 0, function (checked) {
7375
7431
  var element, type;
7432
+ if (checked === void 0) { checked = true; }
7376
7433
  return __generator(this, function (_a) {
7377
7434
  element = this.element;
7378
7435
  type = this.attributes().type;
@@ -7387,6 +7444,7 @@ var DOMWrapper = /** @class */ (function (_super) {
7387
7444
  return [2 /*return*/];
7388
7445
  }
7389
7446
  element.checked = checked;
7447
+ this.trigger('input');
7390
7448
  return [2 /*return*/, this.trigger('change')];
7391
7449
  });
7392
7450
  });
@@ -7416,6 +7474,7 @@ var DOMWrapper = /** @class */ (function (_super) {
7416
7474
  else {
7417
7475
  element.value = value;
7418
7476
  }
7477
+ this.trigger('input');
7419
7478
  return this.trigger('change');
7420
7479
  }
7421
7480
  else if (tagName === 'INPUT' || tagName === 'TEXTAREA') {
@@ -7440,7 +7499,9 @@ var DOMWrapper = /** @class */ (function (_super) {
7440
7499
  if (parentElement.tagName === 'OPTGROUP') {
7441
7500
  parentElement = parentElement.parentElement;
7442
7501
  }
7443
- return new DOMWrapper(parentElement).trigger('change');
7502
+ var parentWrapper = new DOMWrapper(parentElement);
7503
+ parentWrapper.trigger('input');
7504
+ return parentWrapper.trigger('change');
7444
7505
  };
7445
7506
  return DOMWrapper;
7446
7507
  }(BaseWrapper));
@@ -7493,9 +7554,30 @@ function emitted(vm, eventName) {
7493
7554
  return vmEvents;
7494
7555
  }
7495
7556
  var attachEmitListener = function () {
7496
- // use devtools to capture this "emit"
7497
- setDevtoolsHook(createDevTools(), {});
7557
+ var target = getGlobalThis();
7558
+ // override emit to capture events when devtools is defined
7559
+ if (target.__VUE_DEVTOOLS_GLOBAL_HOOK__) {
7560
+ var _emit_1 = target.__VUE_DEVTOOLS_GLOBAL_HOOK__.emit;
7561
+ target.__VUE_DEVTOOLS_GLOBAL_HOOK__.emit = function (eventType) {
7562
+ var payload = [];
7563
+ for (var _i = 1; _i < arguments.length; _i++) {
7564
+ payload[_i - 1] = arguments[_i];
7565
+ }
7566
+ _emit_1.call.apply(_emit_1, __spreadArray([target.__VUE_DEVTOOLS_GLOBAL_HOOK__, eventType], payload, false));
7567
+ captureDevtoolsVueComponentEmitEvent(eventType, payload);
7568
+ };
7569
+ }
7570
+ else {
7571
+ // use devtools to capture this "emit"
7572
+ setDevtoolsHook(createDevTools(), {});
7573
+ }
7498
7574
  };
7575
+ function captureDevtoolsVueComponentEmitEvent(eventType, payload) {
7576
+ if (eventType === "component:emit" /* DevtoolsHooks.COMPONENT_EMIT */) {
7577
+ payload[0]; var componentVM = payload[1], event_1 = payload[2], eventArgs = payload[3];
7578
+ recordEvent(componentVM, event_1, eventArgs);
7579
+ }
7580
+ }
7499
7581
  // devtools hook only catches Vue component custom events
7500
7582
  function createDevTools() {
7501
7583
  return {
@@ -7504,10 +7586,7 @@ function createDevTools() {
7504
7586
  for (var _i = 1; _i < arguments.length; _i++) {
7505
7587
  payload[_i - 1] = arguments[_i];
7506
7588
  }
7507
- if (eventType !== "component:emit" /* DevtoolsHooks.COMPONENT_EMIT */)
7508
- return;
7509
- var componentVM = payload[1], event = payload[2], eventArgs = payload[3];
7510
- recordEvent(componentVM, event, eventArgs);
7589
+ captureDevtoolsVueComponentEmitEvent(eventType, payload);
7511
7590
  }
7512
7591
  };
7513
7592
  }
@@ -7539,9 +7618,18 @@ var removeEventHistory = function (vm) {
7539
7618
  function createVMProxy(vm, setupState) {
7540
7619
  return new Proxy(vm, {
7541
7620
  get: function (vm, key, receiver) {
7542
- if (key in setupState) {
7621
+ if (vm.$.exposed && vm.$.exposeProxy && key in vm.$.exposeProxy) {
7622
+ // first if the key is exposed
7623
+ return Reflect.get(vm.$.exposeProxy, key, receiver);
7624
+ }
7625
+ else if (key in setupState) {
7626
+ // second if the key is acccessible from the setupState
7543
7627
  return Reflect.get(setupState, key, receiver);
7544
7628
  }
7629
+ else if (key in vm.$.appContext.config.globalProperties) {
7630
+ // third if the key is a global property
7631
+ return Reflect.get(vm.$.appContext.config.globalProperties, key, receiver);
7632
+ }
7545
7633
  else {
7546
7634
  // vm.$.ctx is the internal context of the vm
7547
7635
  // with all variables, methods and props
@@ -7760,30 +7848,6 @@ var VueWrapper = /** @class */ (function (_super) {
7760
7848
  }(BaseWrapper));
7761
7849
  registerFactory(WrapperType.VueWrapper, function (app, vm, setProps) { return new VueWrapper(app, vm, setProps); });
7762
7850
 
7763
- var isEnabled = false;
7764
- var wrapperInstances = [];
7765
- function disableAutoUnmount() {
7766
- isEnabled = false;
7767
- wrapperInstances.length = 0;
7768
- }
7769
- function enableAutoUnmount(hook) {
7770
- if (isEnabled) {
7771
- throw new Error('enableAutoUnmount cannot be called more than once');
7772
- }
7773
- isEnabled = true;
7774
- hook(function () {
7775
- wrapperInstances.forEach(function (wrapper) {
7776
- wrapper.unmount();
7777
- });
7778
- wrapperInstances.length = 0;
7779
- });
7780
- }
7781
- function trackInstance(wrapper) {
7782
- if (!isEnabled)
7783
- return;
7784
- wrapperInstances.push(wrapper);
7785
- }
7786
-
7787
7851
  function processSlot(source, Vue$1) {
7788
7852
  if (source === void 0) { source = ''; }
7789
7853
  if (Vue$1 === void 0) { Vue$1 = Vue; }
@@ -7817,24 +7881,30 @@ function processSlot(source, Vue$1) {
7817
7881
 
7818
7882
  var isTeleport = function (type) { return type.__isTeleport; };
7819
7883
  var isKeepAlive = function (type) { return type.__isKeepAlive; };
7884
+ var isRootComponent = function (rootComponents, type, instance) {
7885
+ return !!(!instance ||
7886
+ // Don't stub mounted component on root level
7887
+ (rootComponents.component === type && !(instance === null || instance === void 0 ? void 0 : instance.parent)) ||
7888
+ // Don't stub component with compat wrapper
7889
+ (rootComponents.functional && rootComponents.functional === type));
7890
+ };
7820
7891
  var createVNodeTransformer = function (_a) {
7821
- var transformers = _a.transformers;
7892
+ var rootComponents = _a.rootComponents, transformers = _a.transformers;
7822
7893
  var transformationCache = new WeakMap();
7823
7894
  return function (args, instance) {
7824
7895
  var originalType = args[0], props = args[1], children = args[2], restVNodeArgs = args.slice(3);
7825
7896
  if (!isComponent(originalType)) {
7826
7897
  return __spreadArray([originalType, props, children], restVNodeArgs, true);
7827
7898
  }
7899
+ var componentType = originalType;
7828
7900
  var cachedTransformation = transformationCache.get(originalType);
7829
- if (cachedTransformation) {
7830
- // https://github.com/vuejs/test-utils/issues/1829 & https://github.com/vuejs/test-utils/issues/1888
7831
- // Teleport/KeepAlive should return child nodes as a function
7832
- if (isTeleport(originalType) || isKeepAlive(originalType)) {
7833
- return __spreadArray([cachedTransformation, props, function () { return children; }], restVNodeArgs, true);
7834
- }
7901
+ if (cachedTransformation &&
7902
+ // Don't use cache for root component, as it could use stubbed recursive component
7903
+ !isRootComponent(rootComponents, componentType, instance) &&
7904
+ !isTeleport(originalType) &&
7905
+ !isKeepAlive(originalType)) {
7835
7906
  return __spreadArray([cachedTransformation, props, children], restVNodeArgs, true);
7836
7907
  }
7837
- var componentType = originalType;
7838
7908
  var transformedType = transformers.reduce(function (type, transformer) { return transformer(type, instance); }, componentType);
7839
7909
  if (originalType !== transformedType) {
7840
7910
  transformationCache.set(originalType, transformedType);
@@ -7856,14 +7926,40 @@ var normalizeStubProps = function (props) {
7856
7926
  var _a, _b, _c;
7857
7927
  var _d;
7858
7928
  if (typeof $props[key] === 'symbol') {
7859
- return __assign(__assign({}, acc), (_a = {}, _a[key] = (_d = $props[key]) === null || _d === void 0 ? void 0 : _d.toString(), _a));
7929
+ return __assign(__assign({}, acc), (_a = {}, _a[key] = [(_d = $props[key]) === null || _d === void 0 ? void 0 : _d.toString()], _a));
7860
7930
  }
7861
7931
  if (typeof $props[key] === 'function') {
7862
- return __assign(__assign({}, acc), (_b = {}, _b[key] = '[Function]', _b));
7932
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = ['[Function]'], _b));
7863
7933
  }
7864
7934
  return __assign(__assign({}, acc), (_c = {}, _c[key] = $props[key], _c));
7865
7935
  }, {});
7866
7936
  };
7937
+ var clearAndUpper = function (text) { return text.replace(/-/, '').toUpperCase(); };
7938
+ var kebabToPascalCase = function (tag) {
7939
+ return tag.replace(/(^\w|-\w)/g, clearAndUpper);
7940
+ };
7941
+ var DEFAULT_STUBS = {
7942
+ teleport: isTeleport,
7943
+ 'keep-alive': isKeepAlive,
7944
+ transition: function (type) { return type === Transition || type === BaseTransition; },
7945
+ 'transition-group': function (type) { return type === TransitionGroup; }
7946
+ };
7947
+ var createDefaultStub = function (kebabTag, predicate, type, stubs) {
7948
+ var pascalTag = kebabToPascalCase(kebabTag);
7949
+ if (predicate(type) && (pascalTag in stubs || kebabTag in stubs)) {
7950
+ if (kebabTag in stubs && stubs[kebabTag] === false)
7951
+ return type;
7952
+ if (pascalTag in stubs && stubs[pascalTag] === false)
7953
+ return type;
7954
+ if (stubs[kebabTag] === true || stubs[pascalTag] === true) {
7955
+ return createStub({
7956
+ name: kebabTag,
7957
+ type: type,
7958
+ renderStubDefaultSlot: true
7959
+ });
7960
+ }
7961
+ }
7962
+ };
7867
7963
  var createStub = function (_a) {
7868
7964
  var name = _a.name, type = _a.type, renderStubDefaultSlot = _a.renderStubDefaultSlot;
7869
7965
  var anonName = 'anonymous-stub';
@@ -7871,7 +7967,7 @@ var createStub = function (_a) {
7871
7967
  var componentOptions = type
7872
7968
  ? unwrapLegacyVueExtendComponent(type) || {}
7873
7969
  : {};
7874
- return defineComponent({
7970
+ var stub = defineComponent({
7875
7971
  name: name || anonName,
7876
7972
  props: componentOptions.props || {},
7877
7973
  // fix #1550 - respect old-style v-model for shallow mounted components with @vue/compat
@@ -7889,10 +7985,26 @@ var createStub = function (_a) {
7889
7985
  // Also having function text as attribute is useless and annoying so
7890
7986
  // we replace it with "[Function]""
7891
7987
  var stubProps = normalizeStubProps(props);
7892
- return h(tag, stubProps, renderStubDefaultSlot ? slots : undefined);
7988
+ // if renderStubDefaultSlot is true, we render the default slot
7989
+ if (renderStubDefaultSlot && slots.default) {
7990
+ // we explicitly call the default slot with an empty object
7991
+ // so scope slots destructuring works
7992
+ return h(tag, stubProps, slots.default({}));
7993
+ }
7994
+ return h(tag, stubProps);
7893
7995
  };
7894
7996
  }
7895
7997
  });
7998
+ var asyncLoader = type.__asyncLoader;
7999
+ if (asyncLoader) {
8000
+ asyncLoader().then(function () {
8001
+ registerStub({
8002
+ source: type.__asyncResolved,
8003
+ stub: stub
8004
+ });
8005
+ });
8006
+ }
8007
+ return stub;
7896
8008
  };
7897
8009
  var resolveComponentStubByName = function (componentName, stubs) {
7898
8010
  for (var _i = 0, _a = Object.entries(stubs); _i < _a.length; _i++) {
@@ -7906,56 +8018,14 @@ function createStubComponentsTransformer(_a) {
7906
8018
  var rootComponents = _a.rootComponents, _b = _a.stubs, stubs = _b === void 0 ? {} : _b, _c = _a.shallow, shallow = _c === void 0 ? false : _c, _d = _a.renderStubDefaultSlot, renderStubDefaultSlot = _d === void 0 ? false : _d;
7907
8019
  return function componentsTransformer(type, instance) {
7908
8020
  var _a, _b, _c;
7909
- // stub teleport by default via config.global.stubs
7910
- if (isTeleport(type) && 'teleport' in stubs) {
7911
- if (stubs.teleport === false)
7912
- return type;
7913
- return createStub({
7914
- name: 'teleport',
7915
- type: type,
7916
- renderStubDefaultSlot: true
7917
- });
7918
- }
7919
- // stub keep-alive/KeepAlive by default via config.global.stubs
7920
- if (isKeepAlive(type) && ('keep-alive' in stubs || 'KeepAlive' in stubs)) {
7921
- if ('keep-alive' in stubs && stubs['keep-alive'] === false)
7922
- return type;
7923
- if ('KeepAlive' in stubs && stubs['KeepAlive'] === false)
7924
- return type;
7925
- return createStub({
7926
- name: 'keep-alive',
7927
- type: type,
7928
- renderStubDefaultSlot: true
7929
- });
7930
- }
7931
- // stub transition by default via config.global.stubs
7932
- if ((type === Transition || type === BaseTransition) &&
7933
- 'transition' in stubs) {
7934
- if (stubs.transition === false)
7935
- return type;
7936
- return createStub({
7937
- name: 'transition',
7938
- type: type,
7939
- renderStubDefaultSlot: true
7940
- });
8021
+ for (var tag in DEFAULT_STUBS) {
8022
+ var predicate = DEFAULT_STUBS[tag];
8023
+ var defaultStub = createDefaultStub(tag, predicate, type, stubs);
8024
+ if (defaultStub)
8025
+ return defaultStub;
7941
8026
  }
7942
- // stub transition-group by default via config.global.stubs
7943
- if (type === TransitionGroup && 'transition-group' in stubs) {
7944
- if (stubs['transition-group'] === false)
7945
- return type;
7946
- return createStub({
7947
- name: 'transition-group',
7948
- type: type,
7949
- renderStubDefaultSlot: true
7950
- });
7951
- }
7952
- if (
7953
- // Don't stub VTU_ROOT component
7954
- !instance ||
7955
- // Don't stub mounted component on root level
7956
- (rootComponents.component === type && !(instance === null || instance === void 0 ? void 0 : instance.parent)) ||
7957
- // Don't stub component with compat wrapper
7958
- (rootComponents.functional && rootComponents.functional === type)) {
8027
+ // Don't stub root components
8028
+ if (isRootComponent(rootComponents, type, instance)) {
7959
8029
  return type;
7960
8030
  }
7961
8031
  var registeredName = getComponentRegisteredName(instance, type);
@@ -8008,7 +8078,8 @@ function createStubComponentsTransformer(_a) {
8008
8078
  var stubName = name || registeredName || componentName;
8009
8079
  return ((_c = (_b = (_a = config.plugins).createStubs) === null || _b === void 0 ? void 0 : _b.call(_a, {
8010
8080
  name: stubName,
8011
- component: type
8081
+ component: type,
8082
+ registerStub: registerStub
8012
8083
  })) !== null && _c !== void 0 ? _c : createStub({
8013
8084
  name: stubName,
8014
8085
  type: type,
@@ -8043,6 +8114,38 @@ function createStubDirectivesTransformer(_a) {
8043
8114
  };
8044
8115
  }
8045
8116
 
8117
+ /**
8118
+ * Implementation details of isDeepRef to avoid circular dependencies.
8119
+ * It keeps track of visited objects to avoid infinite recursion.
8120
+ *
8121
+ * @param r The value to check for a Ref.
8122
+ * @param visitedObjects a weak map to keep track of visited objects and avoid infinite recursion
8123
+ * @returns returns true if the value is a Ref, false otherwise
8124
+ */
8125
+ var deeplyCheckForRef = function (r, visitedObjects) {
8126
+ if (isRef(r))
8127
+ return true;
8128
+ if (!isObject(r))
8129
+ return false;
8130
+ if (visitedObjects.has(r))
8131
+ return false;
8132
+ visitedObjects.set(r, true);
8133
+ return Object.values(r).some(function (val) { return deeplyCheckForRef(val, visitedObjects); });
8134
+ };
8135
+ /**
8136
+ * Checks if the given value is a DeepRef.
8137
+ *
8138
+ * For both arrays and objects, it will recursively check
8139
+ * if any of their values is a Ref.
8140
+ *
8141
+ * @param {DeepRef<T> | unknown} r - The value to check.
8142
+ * @returns {boolean} Returns true if the value is a DeepRef, false otherwise.
8143
+ */
8144
+ var isDeepRef = function (r) {
8145
+ var visitedObjects = new WeakMap();
8146
+ return deeplyCheckForRef(r, visitedObjects);
8147
+ };
8148
+
8046
8149
  var MOUNT_OPTIONS = [
8047
8150
  'attachTo',
8048
8151
  'attrs',
@@ -8100,20 +8203,6 @@ function createInstance(inputComponent, options) {
8100
8203
  // We've just replaced our component with its copy
8101
8204
  // Let's register it as a stub so user can find it
8102
8205
  registerStub({ source: originalComponent, stub: component });
8103
- var el = document.createElement('div');
8104
- if (options === null || options === void 0 ? void 0 : options.attachTo) {
8105
- var to = void 0;
8106
- if (typeof options.attachTo === 'string') {
8107
- to = document.querySelector(options.attachTo);
8108
- if (!to) {
8109
- throw new Error("Unable to find the element matching the selector ".concat(options.attachTo, " given as the `attachTo` option"));
8110
- }
8111
- }
8112
- else {
8113
- to = options.attachTo;
8114
- }
8115
- to.appendChild(el);
8116
- }
8117
8206
  function slotToFunction(slot) {
8118
8207
  switch (typeof slot) {
8119
8208
  case 'function':
@@ -8158,7 +8247,7 @@ function createInstance(inputComponent, options) {
8158
8247
  var props = reactive({});
8159
8248
  Object.entries(__assign(__assign(__assign(__assign({}, options === null || options === void 0 ? void 0 : options.attrs), options === null || options === void 0 ? void 0 : options.propsData), options === null || options === void 0 ? void 0 : options.props), { ref: MOUNT_COMPONENT_REF })).forEach(function (_a) {
8160
8249
  var k = _a[0], v = _a[1];
8161
- if (isRef(v)) {
8250
+ if (isDeepRef(v)) {
8162
8251
  refs[k] = v;
8163
8252
  }
8164
8253
  else {
@@ -8190,7 +8279,7 @@ function createInstance(inputComponent, options) {
8190
8279
  attachEmitListener();
8191
8280
  // global mocks mixin
8192
8281
  if (global === null || global === void 0 ? void 0 : global.mocks) {
8193
- var mixin = defineComponent({
8282
+ var mixin = {
8194
8283
  beforeCreate: function () {
8195
8284
  // we need to differentiate components that are or not not `script setup`
8196
8285
  // otherwise we run into a proxy set error
@@ -8226,7 +8315,7 @@ function createInstance(inputComponent, options) {
8226
8315
  }
8227
8316
  }
8228
8317
  }
8229
- });
8318
+ };
8230
8319
  app.mixin(mixin);
8231
8320
  }
8232
8321
  // AppConfig
@@ -8238,10 +8327,18 @@ function createInstance(inputComponent, options) {
8238
8327
  : v;
8239
8328
  }
8240
8329
  }
8330
+ // provide any values passed via provides mounting option
8331
+ if (global.provide) {
8332
+ for (var _c = 0, _d = Reflect.ownKeys(global.provide); _c < _d.length; _c++) {
8333
+ var key = _d[_c];
8334
+ // @ts-ignore: https://github.com/microsoft/TypeScript/issues/1863
8335
+ app.provide(key, global.provide[key]);
8336
+ }
8337
+ }
8241
8338
  // use and plugins from mounting options
8242
8339
  if (global.plugins) {
8243
- for (var _c = 0, _d = global.plugins; _c < _d.length; _c++) {
8244
- var plugin = _d[_c];
8340
+ for (var _e = 0, _f = global.plugins; _e < _f.length; _e++) {
8341
+ var plugin = _f[_e];
8245
8342
  if (Array.isArray(plugin)) {
8246
8343
  app.use.apply(app, __spreadArray([plugin[0]], plugin.slice(1), false));
8247
8344
  continue;
@@ -8251,14 +8348,14 @@ function createInstance(inputComponent, options) {
8251
8348
  }
8252
8349
  // use any mixins from mounting options
8253
8350
  if (global.mixins) {
8254
- for (var _e = 0, _f = global.mixins; _e < _f.length; _e++) {
8255
- var mixin = _f[_e];
8351
+ for (var _g = 0, _h = global.mixins; _g < _h.length; _g++) {
8352
+ var mixin = _h[_g];
8256
8353
  app.mixin(mixin);
8257
8354
  }
8258
8355
  }
8259
8356
  if (global.components) {
8260
- for (var _g = 0, _h = Object.keys(global.components); _g < _h.length; _g++) {
8261
- var key = _h[_g];
8357
+ for (var _j = 0, _k = Object.keys(global.components); _j < _k.length; _j++) {
8358
+ var key = _k[_j];
8262
8359
  // avoid registering components that are stubbed twice
8263
8360
  if (!(key in global.stubs)) {
8264
8361
  app.component(key, global.components[key]);
@@ -8266,23 +8363,16 @@ function createInstance(inputComponent, options) {
8266
8363
  }
8267
8364
  }
8268
8365
  if (global.directives) {
8269
- for (var _j = 0, _k = Object.keys(global.directives); _j < _k.length; _j++) {
8270
- var key = _k[_j];
8271
- app.directive(key, global.directives[key]);
8272
- }
8273
- }
8274
- // provide any values passed via provides mounting option
8275
- if (global.provide) {
8276
- for (var _l = 0, _m = Reflect.ownKeys(global.provide); _l < _m.length; _l++) {
8366
+ for (var _l = 0, _m = Object.keys(global.directives); _l < _m.length; _l++) {
8277
8367
  var key = _m[_l];
8278
- // @ts-ignore: https://github.com/microsoft/TypeScript/issues/1863
8279
- app.provide(key, global.provide[key]);
8368
+ app.directive(key, global.directives[key]);
8280
8369
  }
8281
8370
  }
8282
8371
  // stubs
8283
8372
  // even if we are using `mount`, we will still
8284
8373
  // stub out Transition and Transition Group by default.
8285
8374
  transformVNodeArgs(createVNodeTransformer({
8375
+ rootComponents: rootComponents,
8286
8376
  transformers: [
8287
8377
  createStubComponentsTransformer({
8288
8378
  rootComponents: rootComponents,
@@ -8315,15 +8405,38 @@ function createInstance(inputComponent, options) {
8315
8405
  }
8316
8406
  return {
8317
8407
  app: app,
8318
- el: el,
8319
8408
  props: props,
8320
8409
  componentRef: componentRef
8321
8410
  };
8322
8411
  }
8323
8412
 
8413
+ var isEnabled = false;
8414
+ var wrapperInstances = [];
8415
+ function disableAutoUnmount() {
8416
+ isEnabled = false;
8417
+ wrapperInstances.length = 0;
8418
+ }
8419
+ function enableAutoUnmount(hook) {
8420
+ if (isEnabled) {
8421
+ throw new Error('enableAutoUnmount cannot be called more than once');
8422
+ }
8423
+ isEnabled = true;
8424
+ hook(function () {
8425
+ wrapperInstances.forEach(function (wrapper) {
8426
+ wrapper.unmount();
8427
+ });
8428
+ wrapperInstances.length = 0;
8429
+ });
8430
+ }
8431
+ function trackInstance(wrapper) {
8432
+ if (!isEnabled)
8433
+ return;
8434
+ wrapperInstances.push(wrapper);
8435
+ }
8436
+
8324
8437
  // implementation
8325
8438
  function mount$1(inputComponent, options) {
8326
- var _a = createInstance(inputComponent, options), app = _a.app, props = _a.props, el = _a.el, componentRef = _a.componentRef;
8439
+ var _a = createInstance(inputComponent, options), app = _a.app, props = _a.props, componentRef = _a.componentRef;
8327
8440
  var setProps = function (newProps) {
8328
8441
  for (var _i = 0, _a = Object.entries(newProps); _i < _a.length; _i++) {
8329
8442
  var _b = _a[_i], k = _b[0], v = _b[1];
@@ -8333,15 +8446,30 @@ function mount$1(inputComponent, options) {
8333
8446
  };
8334
8447
  // Workaround for https://github.com/vuejs/core/issues/7020
8335
8448
  var originalErrorHandler = app.config.errorHandler;
8336
- var errorOnMount = null;
8449
+ var errorsOnMount = [];
8337
8450
  app.config.errorHandler = function (err, instance, info) {
8338
- errorOnMount = err;
8451
+ errorsOnMount.push(err);
8339
8452
  return originalErrorHandler === null || originalErrorHandler === void 0 ? void 0 : originalErrorHandler(err, instance, info);
8340
8453
  };
8341
8454
  // mount the app!
8455
+ var el = document.createElement('div');
8456
+ if (options === null || options === void 0 ? void 0 : options.attachTo) {
8457
+ var to = void 0;
8458
+ if (typeof options.attachTo === 'string') {
8459
+ to = document.querySelector(options.attachTo);
8460
+ if (!to) {
8461
+ throw new Error("Unable to find the element matching the selector ".concat(options.attachTo, " given as the `attachTo` option"));
8462
+ }
8463
+ }
8464
+ else {
8465
+ to = options.attachTo;
8466
+ }
8467
+ to.appendChild(el);
8468
+ }
8342
8469
  var vm = app.mount(el);
8343
- if (errorOnMount) {
8344
- throw errorOnMount;
8470
+ if (errorsOnMount.length) {
8471
+ // If several errors are thrown during mount, then throw the first one
8472
+ throw errorsOnMount[0];
8345
8473
  }
8346
8474
  app.config.errorHandler = originalErrorHandler;
8347
8475
  var appRef = componentRef.value;
@@ -8361,6 +8489,9 @@ var shallowMount$1 = function (component, options) {
8361
8489
  };
8362
8490
 
8363
8491
  function renderToString(component, options) {
8492
+ if (options === null || options === void 0 ? void 0 : options.attachTo) {
8493
+ console.warn('attachTo option is not available for renderToString');
8494
+ }
8364
8495
  var app = createInstance(component, options).app;
8365
8496
  return renderToString$1(app);
8366
8497
  }
@@ -8469,7 +8600,6 @@ const cleanup = () => {
8469
8600
  * })
8470
8601
  */
8471
8602
  function mount(componentOptions, options = {}) {
8472
- checkForRemovedStyleOptions(options);
8473
8603
  // Remove last mounted component if cy.mount is called more than once in a test
8474
8604
  cleanup();
8475
8605
  // then wait for cypress to load
@@ -8506,16 +8636,7 @@ function mount(componentOptions, options = {}) {
8506
8636
  wrapper,
8507
8637
  component: wrapper.vm,
8508
8638
  };
8509
- return new Proxy(Object.create(returnVal), {
8510
- get(obj, prop) {
8511
- // throw an error if it looks like the caller is trying to call a method on the VueWrapper that was originally returned
8512
- if (Reflect.get(wrapper, prop)) {
8513
- // @ts-expect-error - internal API
8514
- Cypress.utils.throwErrByPath('mount.vue_yielded_value');
8515
- }
8516
- return Reflect.get(obj, prop);
8517
- },
8518
- });
8639
+ return returnVal;
8519
8640
  });
8520
8641
  });
8521
8642
  }
@@ -8539,21 +8660,6 @@ function getComponentDisplayName(componentOptions) {
8539
8660
  }
8540
8661
  return DEFAULT_COMP_NAME;
8541
8662
  }
8542
- /**
8543
- * Helper function for mounting a component quickly in test hooks.
8544
- * @example
8545
- * import {mountCallback} from '@cypress/vue'
8546
- * beforeEach(mountVue(component, options))
8547
- *
8548
- * Removed as of Cypress 11.0.0.
8549
- * @see https://on.cypress.io/migration-11-0-0-component-testing-updates
8550
- */
8551
- function mountCallback(component, options = {}) {
8552
- return () => {
8553
- // @ts-expect-error - undocumented API
8554
- Cypress.utils.throwErrByPath('mount.mount_callback');
8555
- };
8556
- }
8557
8663
  // Side effects from "import { mount } from '@cypress/<my-framework>'" are annoying, we should avoid doing this
8558
8664
  // by creating an explicit function/import that the user can register in their 'component.js' support file,
8559
8665
  // such as:
@@ -8564,4 +8670,4 @@ function mountCallback(component, options = {}) {
8564
8670
  // Note: This would be a breaking change
8565
8671
  setupHooks(cleanup);
8566
8672
 
8567
- export { VueTestUtils, mount, mountCallback };
8673
+ export { VueTestUtils, mount };