cypress 13.17.0 → 14.0.1

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 +29 -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,7 +1,7 @@
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
 
@@ -44,8 +44,6 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
44
44
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
45
45
  PERFORMANCE OF THIS SOFTWARE.
46
46
  ***************************************************************************** */
47
- /* global Reflect, Promise, SuppressedError, Symbol */
48
-
49
47
 
50
48
  function __rest(s, e) {
51
49
  var t = {};
@@ -77,13 +75,6 @@ const getContainerEl = () => {
77
75
  }
78
76
  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.`);
79
77
  };
80
- function checkForRemovedStyleOptions(mountingOptions) {
81
- for (const key of ['cssFile', 'cssFiles', 'style', 'styles', 'stylesheet', 'stylesheets']) {
82
- if (mountingOptions[key]) {
83
- Cypress.utils.throwErrByPath('mount.removed_style_mounting_options', key);
84
- }
85
- }
86
- }
87
78
  /**
88
79
  * Utility function to register CT side effects and run cleanup code during the "test:before:run" Cypress hook
89
80
  * @param optionalCallback Callback to be called before the next test runs
@@ -127,7 +118,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
127
118
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
128
119
  PERFORMANCE OF THIS SOFTWARE.
129
120
  ***************************************************************************** */
130
- /* global Reflect, Promise */
121
+ /* global Reflect, Promise, SuppressedError, Symbol */
131
122
 
132
123
  var extendStatics = function(d, b) {
133
124
  extendStatics = Object.setPrototypeOf ||
@@ -201,7 +192,12 @@ function __spreadArray(to, from, pack) {
201
192
  }
202
193
  }
203
194
  return to.concat(ar || Array.prototype.slice.call(from));
204
- }
195
+ }
196
+
197
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
198
+ var e = new Error(message);
199
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
200
+ };
205
201
 
206
202
  var Pluggable = /** @class */ (function () {
207
203
  function Pluggable() {
@@ -301,12 +297,30 @@ function mergeGlobalProperties(mountGlobal) {
301
297
  var isObject = function (obj) {
302
298
  return !!obj && typeof obj === 'object';
303
299
  };
300
+ function isClass(obj) {
301
+ if (!(obj instanceof Object))
302
+ return;
303
+ var isCtorClass = obj.constructor && obj.constructor.toString().substring(0, 5) === 'class';
304
+ if (!('prototype' in obj)) {
305
+ return isCtorClass;
306
+ }
307
+ var prototype = obj.prototype;
308
+ var isPrototypeCtorClass = prototype.constructor &&
309
+ prototype.constructor.toString &&
310
+ prototype.constructor.toString().substring(0, 5) === 'class';
311
+ return isCtorClass || isPrototypeCtorClass;
312
+ }
304
313
  // https://stackoverflow.com/a/48218209
305
314
  var mergeDeep = function (target, source) {
315
+ var _a;
306
316
  if (!isObject(target) || !isObject(source)) {
307
317
  return source;
308
318
  }
309
- Object.keys(source).forEach(function (key) {
319
+ Object.keys(source)
320
+ .concat(isClass(source)
321
+ ? Object.getOwnPropertyNames((_a = Object.getPrototypeOf(source)) !== null && _a !== void 0 ? _a : {})
322
+ : Object.getOwnPropertyNames(source))
323
+ .forEach(function (key) {
310
324
  var targetValue = target[key];
311
325
  var sourceValue = source[key];
312
326
  if (Array.isArray(targetValue) && Array.isArray(sourceValue)) {
@@ -391,6 +405,20 @@ function hasSetupState(vm) {
391
405
  function isScriptSetup(vm) {
392
406
  return (vm && vm.$.setupState.__isScriptSetup);
393
407
  }
408
+ var _globalThis;
409
+ var getGlobalThis = function () {
410
+ return (_globalThis ||
411
+ (_globalThis =
412
+ typeof globalThis !== 'undefined'
413
+ ? globalThis
414
+ : typeof self !== 'undefined'
415
+ ? self
416
+ : typeof window !== 'undefined'
417
+ ? window
418
+ : typeof global !== 'undefined'
419
+ ? global
420
+ : {}));
421
+ };
394
422
 
395
423
  var ignorableKeyModifiers = [
396
424
  'stop',
@@ -1675,19 +1703,15 @@ function stringifyNode(node) {
1675
1703
  : new XMLSerializer().serializeToString(node);
1676
1704
  }
1677
1705
 
1678
- var jsExports = {};
1679
- var js = {
1680
- get exports(){ return jsExports; },
1681
- set exports(v){ jsExports = v; },
1682
- };
1706
+ function getDefaultExportFromCjs (x) {
1707
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1708
+ }
1709
+
1710
+ var js = {exports: {}};
1683
1711
 
1684
1712
  var src = {};
1685
1713
 
1686
- var javascriptExports = {};
1687
- var javascript = {
1688
- get exports(){ return javascriptExports; },
1689
- set exports(v){ javascriptExports = v; },
1690
- };
1714
+ var javascript = {exports: {}};
1691
1715
 
1692
1716
  var beautifier$2 = {};
1693
1717
 
@@ -2179,8 +2203,8 @@ function requireAcorn () {
2179
2203
  // in javascript, these two differ
2180
2204
  // in python they are the same, different methods are called on them
2181
2205
  exports.lineBreak = new RegExp('\r\n|' + exports.newline.source);
2182
- exports.allLineBreaks = new RegExp(exports.lineBreak.source, 'g');
2183
- } (acorn));
2206
+ exports.allLineBreaks = new RegExp(exports.lineBreak.source, 'g');
2207
+ } (acorn));
2184
2208
  return acorn;
2185
2209
  }
2186
2210
 
@@ -3348,6 +3372,7 @@ function requireTokenizer$1 () {
3348
3372
 
3349
3373
  token = token || this._read_non_javascript(c);
3350
3374
  token = token || this._read_string(c);
3375
+ token = token || this._read_pair(c, this._input.peek(1)); // Issue #2062 hack for record type '#{'
3351
3376
  token = token || this._read_word(previous_token);
3352
3377
  token = token || this._read_singles(c);
3353
3378
  token = token || this._read_comment(c);
@@ -3406,6 +3431,19 @@ function requireTokenizer$1 () {
3406
3431
  return token;
3407
3432
  };
3408
3433
 
3434
+ Tokenizer.prototype._read_pair = function(c, d) {
3435
+ var token = null;
3436
+ if (c === '#' && d === '{') {
3437
+ token = this._create_token(TOKEN.START_BLOCK, c + d);
3438
+ }
3439
+
3440
+ if (token) {
3441
+ this._input.next();
3442
+ this._input.next();
3443
+ }
3444
+ return token;
3445
+ };
3446
+
3409
3447
  Tokenizer.prototype._read_punctuation = function() {
3410
3448
  var resulting_string = this.__patterns.punct.read();
3411
3449
 
@@ -4492,7 +4530,7 @@ function requireBeautifier$2 () {
4492
4530
  }
4493
4531
  }
4494
4532
  if (this._flags.last_token.type !== TOKEN.OPERATOR && this._flags.last_token.type !== TOKEN.START_EXPR) {
4495
- if (this._flags.last_token.type === TOKEN.START_BLOCK && !this._flags.inline_frame) {
4533
+ if (in_array(this._flags.last_token.type, [TOKEN.START_BLOCK, TOKEN.SEMICOLON]) && !this._flags.inline_frame) {
4496
4534
  this.print_newline();
4497
4535
  } else {
4498
4536
  this._output.space_before_token = true;
@@ -5195,7 +5233,7 @@ function requireBeautifier$2 () {
5195
5233
  var hasRequiredJavascript;
5196
5234
 
5197
5235
  function requireJavascript () {
5198
- if (hasRequiredJavascript) return javascriptExports;
5236
+ if (hasRequiredJavascript) return javascript.exports;
5199
5237
  hasRequiredJavascript = 1;
5200
5238
 
5201
5239
  var Beautifier = requireBeautifier$2().Beautifier,
@@ -5207,17 +5245,13 @@ function requireJavascript () {
5207
5245
  }
5208
5246
 
5209
5247
  javascript.exports = js_beautify;
5210
- javascriptExports.defaultOptions = function() {
5248
+ javascript.exports.defaultOptions = function() {
5211
5249
  return new Options();
5212
5250
  };
5213
- return javascriptExports;
5251
+ return javascript.exports;
5214
5252
  }
5215
5253
 
5216
- var cssExports = {};
5217
- var css = {
5218
- get exports(){ return cssExports; },
5219
- set exports(v){ cssExports = v; },
5220
- };
5254
+ var css = {exports: {}};
5221
5255
 
5222
5256
  var beautifier$1 = {};
5223
5257
 
@@ -5294,18 +5328,18 @@ function requireBeautifier$1 () {
5294
5328
 
5295
5329
  // https://developer.mozilla.org/en-US/docs/Web/CSS/At-rule
5296
5330
  this.NESTED_AT_RULE = {
5297
- "@page": true,
5298
- "@font-face": true,
5299
- "@keyframes": true,
5331
+ "page": true,
5332
+ "font-face": true,
5333
+ "keyframes": true,
5300
5334
  // also in CONDITIONAL_GROUP_RULE below
5301
- "@media": true,
5302
- "@supports": true,
5303
- "@document": true
5335
+ "media": true,
5336
+ "supports": true,
5337
+ "document": true
5304
5338
  };
5305
5339
  this.CONDITIONAL_GROUP_RULE = {
5306
- "@media": true,
5307
- "@supports": true,
5308
- "@document": true
5340
+ "media": true,
5341
+ "supports": true,
5342
+ "document": true
5309
5343
  };
5310
5344
  this.NON_SEMICOLON_NEWLINE_PROPERTY = [
5311
5345
  "grid-template-areas",
@@ -5433,8 +5467,7 @@ function requireBeautifier$1 () {
5433
5467
  // label { content: blue }
5434
5468
  var insidePropertyValue = false;
5435
5469
  var enteringConditionalGroup = false;
5436
- var insideAtExtend = false;
5437
- var insideAtImport = false;
5470
+ var insideNonNestedAtRule = false;
5438
5471
  var insideScssMap = false;
5439
5472
  var topCharacter = this._ch;
5440
5473
  var insideNonSemiColonValues = false;
@@ -5489,10 +5522,32 @@ function requireBeautifier$1 () {
5489
5522
 
5490
5523
  // Ensures any new lines following the comment are preserved
5491
5524
  this.eatWhitespace(true);
5492
- } else if (this._ch === '@' || this._ch === '$') {
5525
+ } else if (this._ch === '$') {
5526
+ this.preserveSingleSpace(isAfterSpace);
5527
+
5528
+ this.print_string(this._ch);
5529
+
5530
+ // strip trailing space, if present, for hash property checks
5531
+ var variable = this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);
5532
+
5533
+ if (variable.match(/[ :]$/)) {
5534
+ // we have a variable or pseudo-class, add it and insert one space before continuing
5535
+ variable = this.eatString(": ").replace(/\s$/, '');
5536
+ this.print_string(variable);
5537
+ this._output.space_before_token = true;
5538
+ }
5539
+
5540
+ variable = variable.replace(/\s$/, '');
5541
+
5542
+ // might be sass variable
5543
+ if (parenLevel === 0 && variable.indexOf(':') !== -1) {
5544
+ insidePropertyValue = true;
5545
+ this.indent();
5546
+ }
5547
+ } else if (this._ch === '@') {
5493
5548
  this.preserveSingleSpace(isAfterSpace);
5494
5549
 
5495
- // deal with less propery mixins @{...}
5550
+ // deal with less property mixins @{...}
5496
5551
  if (this._input.peek() === '{') {
5497
5552
  this.print_string(this._ch + this.eatString('}'));
5498
5553
  } else {
@@ -5510,22 +5565,21 @@ function requireBeautifier$1 () {
5510
5565
 
5511
5566
  variableOrRule = variableOrRule.replace(/\s$/, '');
5512
5567
 
5513
- if (variableOrRule === 'extend') {
5514
- insideAtExtend = true;
5515
- } else if (variableOrRule === 'import') {
5516
- insideAtImport = true;
5517
- }
5568
+ // might be less variable
5569
+ if (parenLevel === 0 && variableOrRule.indexOf(':') !== -1) {
5570
+ insidePropertyValue = true;
5571
+ this.indent();
5518
5572
 
5519
- // might be a nesting at-rule
5520
- if (variableOrRule in this.NESTED_AT_RULE) {
5573
+ // might be a nesting at-rule
5574
+ } else if (variableOrRule in this.NESTED_AT_RULE) {
5521
5575
  this._nestedLevel += 1;
5522
5576
  if (variableOrRule in this.CONDITIONAL_GROUP_RULE) {
5523
5577
  enteringConditionalGroup = true;
5524
5578
  }
5525
- // might be less variable
5526
- } else if (!insideRule && parenLevel === 0 && variableOrRule.indexOf(':') !== -1) {
5527
- insidePropertyValue = true;
5528
- this.indent();
5579
+
5580
+ // might be a non-nested at-rule
5581
+ } else if (parenLevel === 0 && !insidePropertyValue) {
5582
+ insideNonNestedAtRule = true;
5529
5583
  }
5530
5584
  }
5531
5585
  } else if (this._ch === '#' && this._input.peek() === '{') {
@@ -5537,6 +5591,9 @@ function requireBeautifier$1 () {
5537
5591
  this.outdent();
5538
5592
  }
5539
5593
 
5594
+ // non nested at rule becomes nested
5595
+ insideNonNestedAtRule = false;
5596
+
5540
5597
  // when entering conditional groups, only rulesets are allowed
5541
5598
  if (enteringConditionalGroup) {
5542
5599
  enteringConditionalGroup = false;
@@ -5577,8 +5634,7 @@ function requireBeautifier$1 () {
5577
5634
  if (previous_ch === '{') {
5578
5635
  this._output.trim(true);
5579
5636
  }
5580
- insideAtImport = false;
5581
- insideAtExtend = false;
5637
+
5582
5638
  if (insidePropertyValue) {
5583
5639
  this.outdent();
5584
5640
  insidePropertyValue = false;
@@ -5612,9 +5668,10 @@ function requireBeautifier$1 () {
5612
5668
  }
5613
5669
  }
5614
5670
 
5615
- if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !insideAtExtend && parenLevel === 0) {
5671
+ if ((insideRule || enteringConditionalGroup) && !(this._input.lookBack("&") || this.foundNestedPseudoClass()) && !this._input.lookBack("(") && !insideNonNestedAtRule && parenLevel === 0) {
5616
5672
  // 'property: value' delimiter
5617
5673
  // which could be in a conditional group query
5674
+
5618
5675
  this.print_string(':');
5619
5676
  if (!insidePropertyValue) {
5620
5677
  insidePropertyValue = true;
@@ -5651,8 +5708,7 @@ function requireBeautifier$1 () {
5651
5708
  this.outdent();
5652
5709
  insidePropertyValue = false;
5653
5710
  }
5654
- insideAtExtend = false;
5655
- insideAtImport = false;
5711
+ insideNonNestedAtRule = false;
5656
5712
  this.print_string(this._ch);
5657
5713
  this.eatWhitespace(true);
5658
5714
 
@@ -5717,7 +5773,7 @@ function requireBeautifier$1 () {
5717
5773
  } else if (this._ch === ',') {
5718
5774
  this.print_string(this._ch);
5719
5775
  this.eatWhitespace(true);
5720
- if (this._options.selector_separator_newline && (!insidePropertyValue || insideScssMap) && parenLevel === 0 && !insideAtImport && !insideAtExtend) {
5776
+ if (this._options.selector_separator_newline && (!insidePropertyValue || insideScssMap) && parenLevel === 0 && !insideNonNestedAtRule) {
5721
5777
  this._output.add_new_line();
5722
5778
  } else {
5723
5779
  this._output.space_before_token = true;
@@ -5775,7 +5831,7 @@ function requireBeautifier$1 () {
5775
5831
  var hasRequiredCss;
5776
5832
 
5777
5833
  function requireCss () {
5778
- if (hasRequiredCss) return cssExports;
5834
+ if (hasRequiredCss) return css.exports;
5779
5835
  hasRequiredCss = 1;
5780
5836
 
5781
5837
  var Beautifier = requireBeautifier$1().Beautifier,
@@ -5787,17 +5843,13 @@ function requireCss () {
5787
5843
  }
5788
5844
 
5789
5845
  css.exports = css_beautify;
5790
- cssExports.defaultOptions = function() {
5846
+ css.exports.defaultOptions = function() {
5791
5847
  return new Options();
5792
5848
  };
5793
- return cssExports;
5849
+ return css.exports;
5794
5850
  }
5795
5851
 
5796
- var htmlExports = {};
5797
- var html = {
5798
- get exports(){ return htmlExports; },
5799
- set exports(v){ htmlExports = v; },
5800
- };
5852
+ var html = {exports: {}};
5801
5853
 
5802
5854
  var beautifier = {};
5803
5855
 
@@ -5826,6 +5878,7 @@ function requireOptions () {
5826
5878
  this.indent_handlebars = this._get_boolean('indent_handlebars', true);
5827
5879
  this.wrap_attributes = this._get_selection('wrap_attributes',
5828
5880
  ['auto', 'force', 'force-aligned', 'force-expand-multiline', 'aligned-multiple', 'preserve', 'preserve-aligned']);
5881
+ this.wrap_attributes_min_attrs = this._get_number('wrap_attributes_min_attrs', 2);
5829
5882
  this.wrap_attributes_indent_size = this._get_number('wrap_attributes_indent_size', this.indent_size);
5830
5883
  this.extra_liners = this._get_array('extra_liners', ['head', 'body', '/html']);
5831
5884
 
@@ -5843,6 +5896,7 @@ function requireOptions () {
5843
5896
  // obsolete inline tags
5844
5897
  'acronym', 'big', 'strike', 'tt'
5845
5898
  ]);
5899
+ this.inline_custom_elements = this._get_boolean('inline_custom_elements', true);
5846
5900
  this.void_elements = this._get_array('void_elements', [
5847
5901
  // HTLM void elements - aka self-closing tags - aka singletons
5848
5902
  // https://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements
@@ -6466,11 +6520,11 @@ function requireBeautifier () {
6466
6520
  while (raw_token.type !== TOKEN.EOF) {
6467
6521
 
6468
6522
  if (raw_token.type === TOKEN.TAG_OPEN || raw_token.type === TOKEN.COMMENT) {
6469
- parser_token = this._handle_tag_open(printer, raw_token, last_tag_token, last_token);
6523
+ parser_token = this._handle_tag_open(printer, raw_token, last_tag_token, last_token, tokens);
6470
6524
  last_tag_token = parser_token;
6471
6525
  } else if ((raw_token.type === TOKEN.ATTRIBUTE || raw_token.type === TOKEN.EQUALS || raw_token.type === TOKEN.VALUE) ||
6472
6526
  (raw_token.type === TOKEN.TEXT && !last_tag_token.tag_complete)) {
6473
- parser_token = this._handle_inside_tag(printer, raw_token, last_tag_token, tokens);
6527
+ parser_token = this._handle_inside_tag(printer, raw_token, last_tag_token, last_token);
6474
6528
  } else if (raw_token.type === TOKEN.TAG_CLOSE) {
6475
6529
  parser_token = this._handle_tag_close(printer, raw_token, last_tag_token);
6476
6530
  } else if (raw_token.type === TOKEN.TEXT) {
@@ -6527,7 +6581,7 @@ function requireBeautifier () {
6527
6581
  return parser_token;
6528
6582
  };
6529
6583
 
6530
- Beautifier.prototype._handle_inside_tag = function(printer, raw_token, last_tag_token, tokens) {
6584
+ Beautifier.prototype._handle_inside_tag = function(printer, raw_token, last_tag_token, last_token) {
6531
6585
  var wrapped = last_tag_token.has_wrapped_attrs;
6532
6586
  var parser_token = {
6533
6587
  text: raw_token.text,
@@ -6548,7 +6602,6 @@ function requireBeautifier () {
6548
6602
  } else {
6549
6603
  if (raw_token.type === TOKEN.ATTRIBUTE) {
6550
6604
  printer.set_space_before_token(true);
6551
- last_tag_token.attr_count += 1;
6552
6605
  } else if (raw_token.type === TOKEN.EQUALS) { //no space before =
6553
6606
  printer.set_space_before_token(false);
6554
6607
  } else if (raw_token.type === TOKEN.VALUE && raw_token.previous.type === TOKEN.EQUALS) { //no space before value
@@ -6561,29 +6614,15 @@ function requireBeautifier () {
6561
6614
  wrapped = wrapped || raw_token.newlines !== 0;
6562
6615
  }
6563
6616
 
6564
-
6565
- if (this._is_wrap_attributes_force) {
6566
- var force_attr_wrap = last_tag_token.attr_count > 1;
6567
- if (this._is_wrap_attributes_force_expand_multiline && last_tag_token.attr_count === 1) {
6568
- var is_only_attribute = true;
6569
- var peek_index = 0;
6570
- var peek_token;
6571
- do {
6572
- peek_token = tokens.peek(peek_index);
6573
- if (peek_token.type === TOKEN.ATTRIBUTE) {
6574
- is_only_attribute = false;
6575
- break;
6576
- }
6577
- peek_index += 1;
6578
- } while (peek_index < 4 && peek_token.type !== TOKEN.EOF && peek_token.type !== TOKEN.TAG_CLOSE);
6579
-
6580
- force_attr_wrap = !is_only_attribute;
6581
- }
6582
-
6583
- if (force_attr_wrap) {
6584
- printer.print_newline(false);
6585
- wrapped = true;
6586
- }
6617
+ // Wrap for 'force' options, and if the number of attributes is at least that specified in 'wrap_attributes_min_attrs':
6618
+ // 1. always wrap the second and beyond attributes
6619
+ // 2. wrap the first attribute only if 'force-expand-multiline' is specified
6620
+ if (this._is_wrap_attributes_force &&
6621
+ last_tag_token.attr_count >= this._options.wrap_attributes_min_attrs &&
6622
+ (last_token.type !== TOKEN.TAG_OPEN || // ie. second attribute and beyond
6623
+ this._is_wrap_attributes_force_expand_multiline)) {
6624
+ printer.print_newline(false);
6625
+ wrapped = true;
6587
6626
  }
6588
6627
  }
6589
6628
  printer.print_token(raw_token);
@@ -6712,12 +6751,12 @@ function requireBeautifier () {
6712
6751
  }
6713
6752
  };
6714
6753
 
6715
- Beautifier.prototype._handle_tag_open = function(printer, raw_token, last_tag_token, last_token) {
6754
+ Beautifier.prototype._handle_tag_open = function(printer, raw_token, last_tag_token, last_token, tokens) {
6716
6755
  var parser_token = this._get_tag_open_token(raw_token);
6717
6756
 
6718
6757
  if ((last_tag_token.is_unformatted || last_tag_token.is_content_unformatted) &&
6719
6758
  !last_tag_token.is_empty_element &&
6720
- raw_token.type === TOKEN.TAG_OPEN && raw_token.text.indexOf('</') === 0) {
6759
+ raw_token.type === TOKEN.TAG_OPEN && !parser_token.is_start_tag) {
6721
6760
  // End element tags for unformatted or content_unformatted elements
6722
6761
  // are printed raw to keep any newlines inside them exactly the same.
6723
6762
  printer.add_raw_token(raw_token);
@@ -6731,6 +6770,19 @@ function requireBeautifier () {
6731
6770
  printer.print_token(raw_token);
6732
6771
  }
6733
6772
 
6773
+ // count the number of attributes
6774
+ if (parser_token.is_start_tag && this._is_wrap_attributes_force) {
6775
+ var peek_index = 0;
6776
+ var peek_token;
6777
+ do {
6778
+ peek_token = tokens.peek(peek_index);
6779
+ if (peek_token.type === TOKEN.ATTRIBUTE) {
6780
+ parser_token.attr_count += 1;
6781
+ }
6782
+ peek_index += 1;
6783
+ } while (peek_token.type !== TOKEN.EOF && peek_token.type !== TOKEN.TAG_CLOSE);
6784
+ }
6785
+
6734
6786
  //indent attributes an auto, forced, aligned or forced-align line-wrap
6735
6787
  if (this._is_wrap_attributes_force_aligned || this._is_wrap_attributes_aligned_multiple || this._is_wrap_attributes_preserve_aligned) {
6736
6788
  parser_token.alignment_size = raw_token.text.length + 1;
@@ -6828,7 +6880,7 @@ function requireBeautifier () {
6828
6880
 
6829
6881
  parser_token.is_unformatted = !parser_token.tag_complete && in_array(parser_token.tag_check, this._options.unformatted);
6830
6882
  parser_token.is_content_unformatted = !parser_token.is_empty_element && in_array(parser_token.tag_check, this._options.content_unformatted);
6831
- parser_token.is_inline_element = in_array(parser_token.tag_name, this._options.inline) || parser_token.tag_start_char === '{';
6883
+ 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 === '{';
6832
6884
 
6833
6885
  return parser_token;
6834
6886
  };
@@ -6933,7 +6985,7 @@ function requireBeautifier () {
6933
6985
  };
6934
6986
 
6935
6987
  //To be used for <p> tag special case:
6936
- 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'];
6988
+ 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'];
6937
6989
  var p_parent_excludes = ['a', 'audio', 'del', 'ins', 'map', 'noscript', 'video'];
6938
6990
 
6939
6991
  Beautifier.prototype._do_optional_end_element = function(parser_token) {
@@ -6956,7 +7008,7 @@ function requireBeautifier () {
6956
7008
 
6957
7009
  } else if (parser_token.tag_name === 'li') {
6958
7010
  // 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.
6959
- result = result || this._tag_stack.try_pop('li', ['ol', 'ul']);
7011
+ result = result || this._tag_stack.try_pop('li', ['ol', 'ul', 'menu']);
6960
7012
 
6961
7013
  } else if (parser_token.tag_name === 'dd' || parser_token.tag_name === 'dt') {
6962
7014
  // 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.
@@ -7052,7 +7104,7 @@ function requireBeautifier () {
7052
7104
  var hasRequiredHtml;
7053
7105
 
7054
7106
  function requireHtml () {
7055
- if (hasRequiredHtml) return htmlExports;
7107
+ if (hasRequiredHtml) return html.exports;
7056
7108
  hasRequiredHtml = 1;
7057
7109
 
7058
7110
  var Beautifier = requireBeautifier().Beautifier,
@@ -7064,10 +7116,10 @@ function requireHtml () {
7064
7116
  }
7065
7117
 
7066
7118
  html.exports = style_html;
7067
- htmlExports.defaultOptions = function() {
7119
+ html.exports.defaultOptions = function() {
7068
7120
  return new Options();
7069
7121
  };
7070
- return htmlExports;
7122
+ return html.exports;
7071
7123
  }
7072
7124
 
7073
7125
  /*jshint node:true */
@@ -7144,10 +7196,11 @@ function requireSrc () {
7144
7196
  mod.exports = get_beautify(beautifier, beautifier, beautifier);
7145
7197
 
7146
7198
  })(module);
7147
- }
7199
+ }
7148
7200
  } (js));
7149
7201
 
7150
- var beautify = jsExports;
7202
+ var jsExports = js.exports;
7203
+ var beautify = /*@__PURE__*/getDefaultExportFromCjs(jsExports);
7151
7204
 
7152
7205
  var BaseWrapper = /** @class */ (function () {
7153
7206
  function BaseWrapper(element) {
@@ -7232,7 +7285,9 @@ var BaseWrapper = /** @class */ (function () {
7232
7285
  }
7233
7286
  if (matches(currentComponent.vnode, selector) &&
7234
7287
  this.element.contains(currentComponent.vnode.el)) {
7235
- return createVueWrapper(null, currentComponent.proxy);
7288
+ return createVueWrapper(null, currentComponent.subTree.component
7289
+ ? currentComponent.subTree.component.proxy
7290
+ : currentComponent.proxy);
7236
7291
  }
7237
7292
  var result = this.findAllComponents(selector)[0];
7238
7293
  return result !== null && result !== void 0 ? result : createWrapperError('VueWrapper');
@@ -7258,7 +7313,9 @@ var BaseWrapper = /** @class */ (function () {
7258
7313
  return beautify.html(node, {
7259
7314
  unformatted: ['code', 'pre', 'em', 'strong', 'span'],
7260
7315
  indent_inner_html: true,
7261
- indent_size: 2
7316
+ indent_size: 2,
7317
+ inline_custom_elements: false
7318
+ // TODO the cast can be removed when @types/js-beautify will be up-to-date
7262
7319
  });
7263
7320
  })
7264
7321
  .join('\n');
@@ -7283,7 +7340,7 @@ var BaseWrapper = /** @class */ (function () {
7283
7340
  return key ? attributeMap[key] : attributeMap;
7284
7341
  };
7285
7342
  BaseWrapper.prototype.text = function () {
7286
- return textContent(this.element);
7343
+ return this.getRootNodes().map(textContent).join('');
7287
7344
  };
7288
7345
  BaseWrapper.prototype.exists = function () {
7289
7346
  return true;
@@ -7389,10 +7446,10 @@ var DOMWrapper = /** @class */ (function (_super) {
7389
7446
  var results = _super.prototype.findAllComponents.call(this, selector);
7390
7447
  return results.filter(function (r) { return _this.element.contains(r.element); });
7391
7448
  };
7392
- DOMWrapper.prototype.setChecked = function (checked) {
7393
- if (checked === void 0) { checked = true; }
7394
- return __awaiter(this, void 0, void 0, function () {
7449
+ DOMWrapper.prototype.setChecked = function () {
7450
+ return __awaiter(this, arguments, void 0, function (checked) {
7395
7451
  var element, type;
7452
+ if (checked === void 0) { checked = true; }
7396
7453
  return __generator(this, function (_a) {
7397
7454
  element = this.element;
7398
7455
  type = this.attributes().type;
@@ -7407,6 +7464,7 @@ var DOMWrapper = /** @class */ (function (_super) {
7407
7464
  return [2 /*return*/];
7408
7465
  }
7409
7466
  element.checked = checked;
7467
+ this.trigger('input');
7410
7468
  return [2 /*return*/, this.trigger('change')];
7411
7469
  });
7412
7470
  });
@@ -7436,6 +7494,7 @@ var DOMWrapper = /** @class */ (function (_super) {
7436
7494
  else {
7437
7495
  element.value = value;
7438
7496
  }
7497
+ this.trigger('input');
7439
7498
  return this.trigger('change');
7440
7499
  }
7441
7500
  else if (tagName === 'INPUT' || tagName === 'TEXTAREA') {
@@ -7460,7 +7519,9 @@ var DOMWrapper = /** @class */ (function (_super) {
7460
7519
  if (parentElement.tagName === 'OPTGROUP') {
7461
7520
  parentElement = parentElement.parentElement;
7462
7521
  }
7463
- return new DOMWrapper(parentElement).trigger('change');
7522
+ var parentWrapper = new DOMWrapper(parentElement);
7523
+ parentWrapper.trigger('input');
7524
+ return parentWrapper.trigger('change');
7464
7525
  };
7465
7526
  return DOMWrapper;
7466
7527
  }(BaseWrapper));
@@ -7513,9 +7574,30 @@ function emitted(vm, eventName) {
7513
7574
  return vmEvents;
7514
7575
  }
7515
7576
  var attachEmitListener = function () {
7516
- // use devtools to capture this "emit"
7517
- Vue.setDevtoolsHook(createDevTools(), {});
7577
+ var target = getGlobalThis();
7578
+ // override emit to capture events when devtools is defined
7579
+ if (target.__VUE_DEVTOOLS_GLOBAL_HOOK__) {
7580
+ var _emit_1 = target.__VUE_DEVTOOLS_GLOBAL_HOOK__.emit;
7581
+ target.__VUE_DEVTOOLS_GLOBAL_HOOK__.emit = function (eventType) {
7582
+ var payload = [];
7583
+ for (var _i = 1; _i < arguments.length; _i++) {
7584
+ payload[_i - 1] = arguments[_i];
7585
+ }
7586
+ _emit_1.call.apply(_emit_1, __spreadArray([target.__VUE_DEVTOOLS_GLOBAL_HOOK__, eventType], payload, false));
7587
+ captureDevtoolsVueComponentEmitEvent(eventType, payload);
7588
+ };
7589
+ }
7590
+ else {
7591
+ // use devtools to capture this "emit"
7592
+ Vue.setDevtoolsHook(createDevTools(), {});
7593
+ }
7518
7594
  };
7595
+ function captureDevtoolsVueComponentEmitEvent(eventType, payload) {
7596
+ if (eventType === "component:emit" /* DevtoolsHooks.COMPONENT_EMIT */) {
7597
+ payload[0]; var componentVM = payload[1], event_1 = payload[2], eventArgs = payload[3];
7598
+ recordEvent(componentVM, event_1, eventArgs);
7599
+ }
7600
+ }
7519
7601
  // devtools hook only catches Vue component custom events
7520
7602
  function createDevTools() {
7521
7603
  return {
@@ -7524,10 +7606,7 @@ function createDevTools() {
7524
7606
  for (var _i = 1; _i < arguments.length; _i++) {
7525
7607
  payload[_i - 1] = arguments[_i];
7526
7608
  }
7527
- if (eventType !== "component:emit" /* DevtoolsHooks.COMPONENT_EMIT */)
7528
- return;
7529
- var componentVM = payload[1], event = payload[2], eventArgs = payload[3];
7530
- recordEvent(componentVM, event, eventArgs);
7609
+ captureDevtoolsVueComponentEmitEvent(eventType, payload);
7531
7610
  }
7532
7611
  };
7533
7612
  }
@@ -7559,9 +7638,18 @@ var removeEventHistory = function (vm) {
7559
7638
  function createVMProxy(vm, setupState) {
7560
7639
  return new Proxy(vm, {
7561
7640
  get: function (vm, key, receiver) {
7562
- if (key in setupState) {
7641
+ if (vm.$.exposed && vm.$.exposeProxy && key in vm.$.exposeProxy) {
7642
+ // first if the key is exposed
7643
+ return Reflect.get(vm.$.exposeProxy, key, receiver);
7644
+ }
7645
+ else if (key in setupState) {
7646
+ // second if the key is acccessible from the setupState
7563
7647
  return Reflect.get(setupState, key, receiver);
7564
7648
  }
7649
+ else if (key in vm.$.appContext.config.globalProperties) {
7650
+ // third if the key is a global property
7651
+ return Reflect.get(vm.$.appContext.config.globalProperties, key, receiver);
7652
+ }
7565
7653
  else {
7566
7654
  // vm.$.ctx is the internal context of the vm
7567
7655
  // with all variables, methods and props
@@ -7780,30 +7868,6 @@ var VueWrapper = /** @class */ (function (_super) {
7780
7868
  }(BaseWrapper));
7781
7869
  registerFactory(WrapperType.VueWrapper, function (app, vm, setProps) { return new VueWrapper(app, vm, setProps); });
7782
7870
 
7783
- var isEnabled = false;
7784
- var wrapperInstances = [];
7785
- function disableAutoUnmount() {
7786
- isEnabled = false;
7787
- wrapperInstances.length = 0;
7788
- }
7789
- function enableAutoUnmount(hook) {
7790
- if (isEnabled) {
7791
- throw new Error('enableAutoUnmount cannot be called more than once');
7792
- }
7793
- isEnabled = true;
7794
- hook(function () {
7795
- wrapperInstances.forEach(function (wrapper) {
7796
- wrapper.unmount();
7797
- });
7798
- wrapperInstances.length = 0;
7799
- });
7800
- }
7801
- function trackInstance(wrapper) {
7802
- if (!isEnabled)
7803
- return;
7804
- wrapperInstances.push(wrapper);
7805
- }
7806
-
7807
7871
  function processSlot(source, Vue$1) {
7808
7872
  if (source === void 0) { source = ''; }
7809
7873
  if (Vue$1 === void 0) { Vue$1 = Vue__namespace; }
@@ -7837,24 +7901,30 @@ function processSlot(source, Vue$1) {
7837
7901
 
7838
7902
  var isTeleport = function (type) { return type.__isTeleport; };
7839
7903
  var isKeepAlive = function (type) { return type.__isKeepAlive; };
7904
+ var isRootComponent = function (rootComponents, type, instance) {
7905
+ return !!(!instance ||
7906
+ // Don't stub mounted component on root level
7907
+ (rootComponents.component === type && !(instance === null || instance === void 0 ? void 0 : instance.parent)) ||
7908
+ // Don't stub component with compat wrapper
7909
+ (rootComponents.functional && rootComponents.functional === type));
7910
+ };
7840
7911
  var createVNodeTransformer = function (_a) {
7841
- var transformers = _a.transformers;
7912
+ var rootComponents = _a.rootComponents, transformers = _a.transformers;
7842
7913
  var transformationCache = new WeakMap();
7843
7914
  return function (args, instance) {
7844
7915
  var originalType = args[0], props = args[1], children = args[2], restVNodeArgs = args.slice(3);
7845
7916
  if (!isComponent(originalType)) {
7846
7917
  return __spreadArray([originalType, props, children], restVNodeArgs, true);
7847
7918
  }
7919
+ var componentType = originalType;
7848
7920
  var cachedTransformation = transformationCache.get(originalType);
7849
- if (cachedTransformation) {
7850
- // https://github.com/vuejs/test-utils/issues/1829 & https://github.com/vuejs/test-utils/issues/1888
7851
- // Teleport/KeepAlive should return child nodes as a function
7852
- if (isTeleport(originalType) || isKeepAlive(originalType)) {
7853
- return __spreadArray([cachedTransformation, props, function () { return children; }], restVNodeArgs, true);
7854
- }
7921
+ if (cachedTransformation &&
7922
+ // Don't use cache for root component, as it could use stubbed recursive component
7923
+ !isRootComponent(rootComponents, componentType, instance) &&
7924
+ !isTeleport(originalType) &&
7925
+ !isKeepAlive(originalType)) {
7855
7926
  return __spreadArray([cachedTransformation, props, children], restVNodeArgs, true);
7856
7927
  }
7857
- var componentType = originalType;
7858
7928
  var transformedType = transformers.reduce(function (type, transformer) { return transformer(type, instance); }, componentType);
7859
7929
  if (originalType !== transformedType) {
7860
7930
  transformationCache.set(originalType, transformedType);
@@ -7876,14 +7946,40 @@ var normalizeStubProps = function (props) {
7876
7946
  var _a, _b, _c;
7877
7947
  var _d;
7878
7948
  if (typeof $props[key] === 'symbol') {
7879
- return __assign(__assign({}, acc), (_a = {}, _a[key] = (_d = $props[key]) === null || _d === void 0 ? void 0 : _d.toString(), _a));
7949
+ return __assign(__assign({}, acc), (_a = {}, _a[key] = [(_d = $props[key]) === null || _d === void 0 ? void 0 : _d.toString()], _a));
7880
7950
  }
7881
7951
  if (typeof $props[key] === 'function') {
7882
- return __assign(__assign({}, acc), (_b = {}, _b[key] = '[Function]', _b));
7952
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = ['[Function]'], _b));
7883
7953
  }
7884
7954
  return __assign(__assign({}, acc), (_c = {}, _c[key] = $props[key], _c));
7885
7955
  }, {});
7886
7956
  };
7957
+ var clearAndUpper = function (text) { return text.replace(/-/, '').toUpperCase(); };
7958
+ var kebabToPascalCase = function (tag) {
7959
+ return tag.replace(/(^\w|-\w)/g, clearAndUpper);
7960
+ };
7961
+ var DEFAULT_STUBS = {
7962
+ teleport: isTeleport,
7963
+ 'keep-alive': isKeepAlive,
7964
+ transition: function (type) { return type === Vue.Transition || type === Vue.BaseTransition; },
7965
+ 'transition-group': function (type) { return type === Vue.TransitionGroup; }
7966
+ };
7967
+ var createDefaultStub = function (kebabTag, predicate, type, stubs) {
7968
+ var pascalTag = kebabToPascalCase(kebabTag);
7969
+ if (predicate(type) && (pascalTag in stubs || kebabTag in stubs)) {
7970
+ if (kebabTag in stubs && stubs[kebabTag] === false)
7971
+ return type;
7972
+ if (pascalTag in stubs && stubs[pascalTag] === false)
7973
+ return type;
7974
+ if (stubs[kebabTag] === true || stubs[pascalTag] === true) {
7975
+ return createStub({
7976
+ name: kebabTag,
7977
+ type: type,
7978
+ renderStubDefaultSlot: true
7979
+ });
7980
+ }
7981
+ }
7982
+ };
7887
7983
  var createStub = function (_a) {
7888
7984
  var name = _a.name, type = _a.type, renderStubDefaultSlot = _a.renderStubDefaultSlot;
7889
7985
  var anonName = 'anonymous-stub';
@@ -7891,7 +7987,7 @@ var createStub = function (_a) {
7891
7987
  var componentOptions = type
7892
7988
  ? unwrapLegacyVueExtendComponent(type) || {}
7893
7989
  : {};
7894
- return Vue.defineComponent({
7990
+ var stub = Vue.defineComponent({
7895
7991
  name: name || anonName,
7896
7992
  props: componentOptions.props || {},
7897
7993
  // fix #1550 - respect old-style v-model for shallow mounted components with @vue/compat
@@ -7909,10 +8005,26 @@ var createStub = function (_a) {
7909
8005
  // Also having function text as attribute is useless and annoying so
7910
8006
  // we replace it with "[Function]""
7911
8007
  var stubProps = normalizeStubProps(props);
7912
- return Vue.h(tag, stubProps, renderStubDefaultSlot ? slots : undefined);
8008
+ // if renderStubDefaultSlot is true, we render the default slot
8009
+ if (renderStubDefaultSlot && slots.default) {
8010
+ // we explicitly call the default slot with an empty object
8011
+ // so scope slots destructuring works
8012
+ return Vue.h(tag, stubProps, slots.default({}));
8013
+ }
8014
+ return Vue.h(tag, stubProps);
7913
8015
  };
7914
8016
  }
7915
8017
  });
8018
+ var asyncLoader = type.__asyncLoader;
8019
+ if (asyncLoader) {
8020
+ asyncLoader().then(function () {
8021
+ registerStub({
8022
+ source: type.__asyncResolved,
8023
+ stub: stub
8024
+ });
8025
+ });
8026
+ }
8027
+ return stub;
7916
8028
  };
7917
8029
  var resolveComponentStubByName = function (componentName, stubs) {
7918
8030
  for (var _i = 0, _a = Object.entries(stubs); _i < _a.length; _i++) {
@@ -7926,56 +8038,14 @@ function createStubComponentsTransformer(_a) {
7926
8038
  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;
7927
8039
  return function componentsTransformer(type, instance) {
7928
8040
  var _a, _b, _c;
7929
- // stub teleport by default via config.global.stubs
7930
- if (isTeleport(type) && 'teleport' in stubs) {
7931
- if (stubs.teleport === false)
7932
- return type;
7933
- return createStub({
7934
- name: 'teleport',
7935
- type: type,
7936
- renderStubDefaultSlot: true
7937
- });
7938
- }
7939
- // stub keep-alive/KeepAlive by default via config.global.stubs
7940
- if (isKeepAlive(type) && ('keep-alive' in stubs || 'KeepAlive' in stubs)) {
7941
- if ('keep-alive' in stubs && stubs['keep-alive'] === false)
7942
- return type;
7943
- if ('KeepAlive' in stubs && stubs['KeepAlive'] === false)
7944
- return type;
7945
- return createStub({
7946
- name: 'keep-alive',
7947
- type: type,
7948
- renderStubDefaultSlot: true
7949
- });
7950
- }
7951
- // stub transition by default via config.global.stubs
7952
- if ((type === Vue.Transition || type === Vue.BaseTransition) &&
7953
- 'transition' in stubs) {
7954
- if (stubs.transition === false)
7955
- return type;
7956
- return createStub({
7957
- name: 'transition',
7958
- type: type,
7959
- renderStubDefaultSlot: true
7960
- });
8041
+ for (var tag in DEFAULT_STUBS) {
8042
+ var predicate = DEFAULT_STUBS[tag];
8043
+ var defaultStub = createDefaultStub(tag, predicate, type, stubs);
8044
+ if (defaultStub)
8045
+ return defaultStub;
7961
8046
  }
7962
- // stub transition-group by default via config.global.stubs
7963
- if (type === Vue.TransitionGroup && 'transition-group' in stubs) {
7964
- if (stubs['transition-group'] === false)
7965
- return type;
7966
- return createStub({
7967
- name: 'transition-group',
7968
- type: type,
7969
- renderStubDefaultSlot: true
7970
- });
7971
- }
7972
- if (
7973
- // Don't stub VTU_ROOT component
7974
- !instance ||
7975
- // Don't stub mounted component on root level
7976
- (rootComponents.component === type && !(instance === null || instance === void 0 ? void 0 : instance.parent)) ||
7977
- // Don't stub component with compat wrapper
7978
- (rootComponents.functional && rootComponents.functional === type)) {
8047
+ // Don't stub root components
8048
+ if (isRootComponent(rootComponents, type, instance)) {
7979
8049
  return type;
7980
8050
  }
7981
8051
  var registeredName = getComponentRegisteredName(instance, type);
@@ -8028,7 +8098,8 @@ function createStubComponentsTransformer(_a) {
8028
8098
  var stubName = name || registeredName || componentName;
8029
8099
  return ((_c = (_b = (_a = config.plugins).createStubs) === null || _b === void 0 ? void 0 : _b.call(_a, {
8030
8100
  name: stubName,
8031
- component: type
8101
+ component: type,
8102
+ registerStub: registerStub
8032
8103
  })) !== null && _c !== void 0 ? _c : createStub({
8033
8104
  name: stubName,
8034
8105
  type: type,
@@ -8063,6 +8134,38 @@ function createStubDirectivesTransformer(_a) {
8063
8134
  };
8064
8135
  }
8065
8136
 
8137
+ /**
8138
+ * Implementation details of isDeepRef to avoid circular dependencies.
8139
+ * It keeps track of visited objects to avoid infinite recursion.
8140
+ *
8141
+ * @param r The value to check for a Ref.
8142
+ * @param visitedObjects a weak map to keep track of visited objects and avoid infinite recursion
8143
+ * @returns returns true if the value is a Ref, false otherwise
8144
+ */
8145
+ var deeplyCheckForRef = function (r, visitedObjects) {
8146
+ if (Vue.isRef(r))
8147
+ return true;
8148
+ if (!isObject(r))
8149
+ return false;
8150
+ if (visitedObjects.has(r))
8151
+ return false;
8152
+ visitedObjects.set(r, true);
8153
+ return Object.values(r).some(function (val) { return deeplyCheckForRef(val, visitedObjects); });
8154
+ };
8155
+ /**
8156
+ * Checks if the given value is a DeepRef.
8157
+ *
8158
+ * For both arrays and objects, it will recursively check
8159
+ * if any of their values is a Ref.
8160
+ *
8161
+ * @param {DeepRef<T> | unknown} r - The value to check.
8162
+ * @returns {boolean} Returns true if the value is a DeepRef, false otherwise.
8163
+ */
8164
+ var isDeepRef = function (r) {
8165
+ var visitedObjects = new WeakMap();
8166
+ return deeplyCheckForRef(r, visitedObjects);
8167
+ };
8168
+
8066
8169
  var MOUNT_OPTIONS = [
8067
8170
  'attachTo',
8068
8171
  'attrs',
@@ -8120,20 +8223,6 @@ function createInstance(inputComponent, options) {
8120
8223
  // We've just replaced our component with its copy
8121
8224
  // Let's register it as a stub so user can find it
8122
8225
  registerStub({ source: originalComponent, stub: component });
8123
- var el = document.createElement('div');
8124
- if (options === null || options === void 0 ? void 0 : options.attachTo) {
8125
- var to = void 0;
8126
- if (typeof options.attachTo === 'string') {
8127
- to = document.querySelector(options.attachTo);
8128
- if (!to) {
8129
- throw new Error("Unable to find the element matching the selector ".concat(options.attachTo, " given as the `attachTo` option"));
8130
- }
8131
- }
8132
- else {
8133
- to = options.attachTo;
8134
- }
8135
- to.appendChild(el);
8136
- }
8137
8226
  function slotToFunction(slot) {
8138
8227
  switch (typeof slot) {
8139
8228
  case 'function':
@@ -8178,7 +8267,7 @@ function createInstance(inputComponent, options) {
8178
8267
  var props = Vue.reactive({});
8179
8268
  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) {
8180
8269
  var k = _a[0], v = _a[1];
8181
- if (Vue.isRef(v)) {
8270
+ if (isDeepRef(v)) {
8182
8271
  refs[k] = v;
8183
8272
  }
8184
8273
  else {
@@ -8210,7 +8299,7 @@ function createInstance(inputComponent, options) {
8210
8299
  attachEmitListener();
8211
8300
  // global mocks mixin
8212
8301
  if (global === null || global === void 0 ? void 0 : global.mocks) {
8213
- var mixin = Vue.defineComponent({
8302
+ var mixin = {
8214
8303
  beforeCreate: function () {
8215
8304
  // we need to differentiate components that are or not not `script setup`
8216
8305
  // otherwise we run into a proxy set error
@@ -8246,7 +8335,7 @@ function createInstance(inputComponent, options) {
8246
8335
  }
8247
8336
  }
8248
8337
  }
8249
- });
8338
+ };
8250
8339
  app.mixin(mixin);
8251
8340
  }
8252
8341
  // AppConfig
@@ -8258,10 +8347,18 @@ function createInstance(inputComponent, options) {
8258
8347
  : v;
8259
8348
  }
8260
8349
  }
8350
+ // provide any values passed via provides mounting option
8351
+ if (global.provide) {
8352
+ for (var _c = 0, _d = Reflect.ownKeys(global.provide); _c < _d.length; _c++) {
8353
+ var key = _d[_c];
8354
+ // @ts-ignore: https://github.com/microsoft/TypeScript/issues/1863
8355
+ app.provide(key, global.provide[key]);
8356
+ }
8357
+ }
8261
8358
  // use and plugins from mounting options
8262
8359
  if (global.plugins) {
8263
- for (var _c = 0, _d = global.plugins; _c < _d.length; _c++) {
8264
- var plugin = _d[_c];
8360
+ for (var _e = 0, _f = global.plugins; _e < _f.length; _e++) {
8361
+ var plugin = _f[_e];
8265
8362
  if (Array.isArray(plugin)) {
8266
8363
  app.use.apply(app, __spreadArray([plugin[0]], plugin.slice(1), false));
8267
8364
  continue;
@@ -8271,14 +8368,14 @@ function createInstance(inputComponent, options) {
8271
8368
  }
8272
8369
  // use any mixins from mounting options
8273
8370
  if (global.mixins) {
8274
- for (var _e = 0, _f = global.mixins; _e < _f.length; _e++) {
8275
- var mixin = _f[_e];
8371
+ for (var _g = 0, _h = global.mixins; _g < _h.length; _g++) {
8372
+ var mixin = _h[_g];
8276
8373
  app.mixin(mixin);
8277
8374
  }
8278
8375
  }
8279
8376
  if (global.components) {
8280
- for (var _g = 0, _h = Object.keys(global.components); _g < _h.length; _g++) {
8281
- var key = _h[_g];
8377
+ for (var _j = 0, _k = Object.keys(global.components); _j < _k.length; _j++) {
8378
+ var key = _k[_j];
8282
8379
  // avoid registering components that are stubbed twice
8283
8380
  if (!(key in global.stubs)) {
8284
8381
  app.component(key, global.components[key]);
@@ -8286,23 +8383,16 @@ function createInstance(inputComponent, options) {
8286
8383
  }
8287
8384
  }
8288
8385
  if (global.directives) {
8289
- for (var _j = 0, _k = Object.keys(global.directives); _j < _k.length; _j++) {
8290
- var key = _k[_j];
8291
- app.directive(key, global.directives[key]);
8292
- }
8293
- }
8294
- // provide any values passed via provides mounting option
8295
- if (global.provide) {
8296
- for (var _l = 0, _m = Reflect.ownKeys(global.provide); _l < _m.length; _l++) {
8386
+ for (var _l = 0, _m = Object.keys(global.directives); _l < _m.length; _l++) {
8297
8387
  var key = _m[_l];
8298
- // @ts-ignore: https://github.com/microsoft/TypeScript/issues/1863
8299
- app.provide(key, global.provide[key]);
8388
+ app.directive(key, global.directives[key]);
8300
8389
  }
8301
8390
  }
8302
8391
  // stubs
8303
8392
  // even if we are using `mount`, we will still
8304
8393
  // stub out Transition and Transition Group by default.
8305
8394
  Vue.transformVNodeArgs(createVNodeTransformer({
8395
+ rootComponents: rootComponents,
8306
8396
  transformers: [
8307
8397
  createStubComponentsTransformer({
8308
8398
  rootComponents: rootComponents,
@@ -8335,15 +8425,38 @@ function createInstance(inputComponent, options) {
8335
8425
  }
8336
8426
  return {
8337
8427
  app: app,
8338
- el: el,
8339
8428
  props: props,
8340
8429
  componentRef: componentRef
8341
8430
  };
8342
8431
  }
8343
8432
 
8433
+ var isEnabled = false;
8434
+ var wrapperInstances = [];
8435
+ function disableAutoUnmount() {
8436
+ isEnabled = false;
8437
+ wrapperInstances.length = 0;
8438
+ }
8439
+ function enableAutoUnmount(hook) {
8440
+ if (isEnabled) {
8441
+ throw new Error('enableAutoUnmount cannot be called more than once');
8442
+ }
8443
+ isEnabled = true;
8444
+ hook(function () {
8445
+ wrapperInstances.forEach(function (wrapper) {
8446
+ wrapper.unmount();
8447
+ });
8448
+ wrapperInstances.length = 0;
8449
+ });
8450
+ }
8451
+ function trackInstance(wrapper) {
8452
+ if (!isEnabled)
8453
+ return;
8454
+ wrapperInstances.push(wrapper);
8455
+ }
8456
+
8344
8457
  // implementation
8345
8458
  function mount$1(inputComponent, options) {
8346
- var _a = createInstance(inputComponent, options), app = _a.app, props = _a.props, el = _a.el, componentRef = _a.componentRef;
8459
+ var _a = createInstance(inputComponent, options), app = _a.app, props = _a.props, componentRef = _a.componentRef;
8347
8460
  var setProps = function (newProps) {
8348
8461
  for (var _i = 0, _a = Object.entries(newProps); _i < _a.length; _i++) {
8349
8462
  var _b = _a[_i], k = _b[0], v = _b[1];
@@ -8353,15 +8466,30 @@ function mount$1(inputComponent, options) {
8353
8466
  };
8354
8467
  // Workaround for https://github.com/vuejs/core/issues/7020
8355
8468
  var originalErrorHandler = app.config.errorHandler;
8356
- var errorOnMount = null;
8469
+ var errorsOnMount = [];
8357
8470
  app.config.errorHandler = function (err, instance, info) {
8358
- errorOnMount = err;
8471
+ errorsOnMount.push(err);
8359
8472
  return originalErrorHandler === null || originalErrorHandler === void 0 ? void 0 : originalErrorHandler(err, instance, info);
8360
8473
  };
8361
8474
  // mount the app!
8475
+ var el = document.createElement('div');
8476
+ if (options === null || options === void 0 ? void 0 : options.attachTo) {
8477
+ var to = void 0;
8478
+ if (typeof options.attachTo === 'string') {
8479
+ to = document.querySelector(options.attachTo);
8480
+ if (!to) {
8481
+ throw new Error("Unable to find the element matching the selector ".concat(options.attachTo, " given as the `attachTo` option"));
8482
+ }
8483
+ }
8484
+ else {
8485
+ to = options.attachTo;
8486
+ }
8487
+ to.appendChild(el);
8488
+ }
8362
8489
  var vm = app.mount(el);
8363
- if (errorOnMount) {
8364
- throw errorOnMount;
8490
+ if (errorsOnMount.length) {
8491
+ // If several errors are thrown during mount, then throw the first one
8492
+ throw errorsOnMount[0];
8365
8493
  }
8366
8494
  app.config.errorHandler = originalErrorHandler;
8367
8495
  var appRef = componentRef.value;
@@ -8381,6 +8509,9 @@ var shallowMount$1 = function (component, options) {
8381
8509
  };
8382
8510
 
8383
8511
  function renderToString(component, options) {
8512
+ if (options === null || options === void 0 ? void 0 : options.attachTo) {
8513
+ console.warn('attachTo option is not available for renderToString');
8514
+ }
8384
8515
  var app = createInstance(component, options).app;
8385
8516
  return serverRenderer.renderToString(app);
8386
8517
  }
@@ -8489,7 +8620,6 @@ const cleanup = () => {
8489
8620
  * })
8490
8621
  */
8491
8622
  function mount(componentOptions, options = {}) {
8492
- checkForRemovedStyleOptions(options);
8493
8623
  // Remove last mounted component if cy.mount is called more than once in a test
8494
8624
  cleanup();
8495
8625
  // then wait for cypress to load
@@ -8526,16 +8656,7 @@ function mount(componentOptions, options = {}) {
8526
8656
  wrapper,
8527
8657
  component: wrapper.vm,
8528
8658
  };
8529
- return new Proxy(Object.create(returnVal), {
8530
- get(obj, prop) {
8531
- // throw an error if it looks like the caller is trying to call a method on the VueWrapper that was originally returned
8532
- if (Reflect.get(wrapper, prop)) {
8533
- // @ts-expect-error - internal API
8534
- Cypress.utils.throwErrByPath('mount.vue_yielded_value');
8535
- }
8536
- return Reflect.get(obj, prop);
8537
- },
8538
- });
8659
+ return returnVal;
8539
8660
  });
8540
8661
  });
8541
8662
  }
@@ -8559,21 +8680,6 @@ function getComponentDisplayName(componentOptions) {
8559
8680
  }
8560
8681
  return DEFAULT_COMP_NAME;
8561
8682
  }
8562
- /**
8563
- * Helper function for mounting a component quickly in test hooks.
8564
- * @example
8565
- * import {mountCallback} from '@cypress/vue'
8566
- * beforeEach(mountVue(component, options))
8567
- *
8568
- * Removed as of Cypress 11.0.0.
8569
- * @see https://on.cypress.io/migration-11-0-0-component-testing-updates
8570
- */
8571
- function mountCallback(component, options = {}) {
8572
- return () => {
8573
- // @ts-expect-error - undocumented API
8574
- Cypress.utils.throwErrByPath('mount.mount_callback');
8575
- };
8576
- }
8577
8683
  // Side effects from "import { mount } from '@cypress/<my-framework>'" are annoying, we should avoid doing this
8578
8684
  // by creating an explicit function/import that the user can register in their 'component.js' support file,
8579
8685
  // such as:
@@ -8586,4 +8692,3 @@ setupHooks(cleanup);
8586
8692
 
8587
8693
  exports.VueTestUtils = VueTestUtils;
8588
8694
  exports.mount = mount;
8589
- exports.mountCallback = mountCallback;