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,14 +1,14 @@
1
1
 
2
2
  /**
3
3
  * @cypress/angular 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 'zone.js';
9
9
  import 'zone.js/testing';
10
10
  import { CommonModule } from '@angular/common';
11
- import { Injectable, Component, EventEmitter, SimpleChange, ErrorHandler } from '@angular/core';
11
+ import { assertInInjectionContext, inject, Injector, effect, untracked, DestroyRef, Injectable, Component, EventEmitter, SimpleChange, ErrorHandler, signal } from '@angular/core';
12
12
  import { getTestBed, TestComponentRenderer, TestBed } from '@angular/core/testing';
13
13
  import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing';
14
14
 
@@ -28,6 +28,20 @@ PERFORMANCE OF THIS SOFTWARE.
28
28
  ***************************************************************************** */
29
29
  /* global Reflect, Promise, SuppressedError, Symbol */
30
30
 
31
+ var extendStatics = function(d, b) {
32
+ extendStatics = Object.setPrototypeOf ||
33
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
34
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
35
+ return extendStatics(d, b);
36
+ };
37
+
38
+ function __extends(d, b) {
39
+ if (typeof b !== "function" && b !== null)
40
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
41
+ extendStatics(d, b);
42
+ function __() { this.constructor = d; }
43
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
44
+ }
31
45
 
32
46
  function __rest(s, e) {
33
47
  var t = {};
@@ -48,11 +62,792 @@ function __decorate(decorators, target, key, desc) {
48
62
  return c > 3 && r && Object.defineProperty(target, key, r), r;
49
63
  }
50
64
 
65
+ function __values(o) {
66
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
67
+ if (m) return m.call(o);
68
+ if (o && typeof o.length === "number") return {
69
+ next: function () {
70
+ if (o && i >= o.length) o = void 0;
71
+ return { value: o && o[i++], done: !o };
72
+ }
73
+ };
74
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
75
+ }
76
+
77
+ function __read(o, n) {
78
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
79
+ if (!m) return o;
80
+ var i = m.call(o), r, ar = [], e;
81
+ try {
82
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
83
+ }
84
+ catch (error) { e = { error: error }; }
85
+ finally {
86
+ try {
87
+ if (r && !r.done && (m = i["return"])) m.call(i);
88
+ }
89
+ finally { if (e) throw e.error; }
90
+ }
91
+ return ar;
92
+ }
93
+
94
+ function __spreadArray(to, from, pack) {
95
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
96
+ if (ar || !(i in from)) {
97
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
98
+ ar[i] = from[i];
99
+ }
100
+ }
101
+ return to.concat(ar || Array.prototype.slice.call(from));
102
+ }
103
+
51
104
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
52
105
  var e = new Error(message);
53
106
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
54
107
  };
55
108
 
109
+ function isFunction(value) {
110
+ return typeof value === 'function';
111
+ }
112
+
113
+ function createErrorClass(createImpl) {
114
+ var _super = function (instance) {
115
+ Error.call(instance);
116
+ instance.stack = new Error().stack;
117
+ };
118
+ var ctorFunc = createImpl(_super);
119
+ ctorFunc.prototype = Object.create(Error.prototype);
120
+ ctorFunc.prototype.constructor = ctorFunc;
121
+ return ctorFunc;
122
+ }
123
+
124
+ var UnsubscriptionError = createErrorClass(function (_super) {
125
+ return function UnsubscriptionErrorImpl(errors) {
126
+ _super(this);
127
+ this.message = errors
128
+ ? errors.length + " errors occurred during unsubscription:\n" + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ')
129
+ : '';
130
+ this.name = 'UnsubscriptionError';
131
+ this.errors = errors;
132
+ };
133
+ });
134
+
135
+ function arrRemove(arr, item) {
136
+ if (arr) {
137
+ var index = arr.indexOf(item);
138
+ 0 <= index && arr.splice(index, 1);
139
+ }
140
+ }
141
+
142
+ var Subscription = (function () {
143
+ function Subscription(initialTeardown) {
144
+ this.initialTeardown = initialTeardown;
145
+ this.closed = false;
146
+ this._parentage = null;
147
+ this._finalizers = null;
148
+ }
149
+ Subscription.prototype.unsubscribe = function () {
150
+ var e_1, _a, e_2, _b;
151
+ var errors;
152
+ if (!this.closed) {
153
+ this.closed = true;
154
+ var _parentage = this._parentage;
155
+ if (_parentage) {
156
+ this._parentage = null;
157
+ if (Array.isArray(_parentage)) {
158
+ try {
159
+ for (var _parentage_1 = __values(_parentage), _parentage_1_1 = _parentage_1.next(); !_parentage_1_1.done; _parentage_1_1 = _parentage_1.next()) {
160
+ var parent_1 = _parentage_1_1.value;
161
+ parent_1.remove(this);
162
+ }
163
+ }
164
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
165
+ finally {
166
+ try {
167
+ if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1);
168
+ }
169
+ finally { if (e_1) throw e_1.error; }
170
+ }
171
+ }
172
+ else {
173
+ _parentage.remove(this);
174
+ }
175
+ }
176
+ var initialFinalizer = this.initialTeardown;
177
+ if (isFunction(initialFinalizer)) {
178
+ try {
179
+ initialFinalizer();
180
+ }
181
+ catch (e) {
182
+ errors = e instanceof UnsubscriptionError ? e.errors : [e];
183
+ }
184
+ }
185
+ var _finalizers = this._finalizers;
186
+ if (_finalizers) {
187
+ this._finalizers = null;
188
+ try {
189
+ for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
190
+ var finalizer = _finalizers_1_1.value;
191
+ try {
192
+ execFinalizer(finalizer);
193
+ }
194
+ catch (err) {
195
+ errors = errors !== null && errors !== void 0 ? errors : [];
196
+ if (err instanceof UnsubscriptionError) {
197
+ errors = __spreadArray(__spreadArray([], __read(errors)), __read(err.errors));
198
+ }
199
+ else {
200
+ errors.push(err);
201
+ }
202
+ }
203
+ }
204
+ }
205
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
206
+ finally {
207
+ try {
208
+ if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
209
+ }
210
+ finally { if (e_2) throw e_2.error; }
211
+ }
212
+ }
213
+ if (errors) {
214
+ throw new UnsubscriptionError(errors);
215
+ }
216
+ }
217
+ };
218
+ Subscription.prototype.add = function (teardown) {
219
+ var _a;
220
+ if (teardown && teardown !== this) {
221
+ if (this.closed) {
222
+ execFinalizer(teardown);
223
+ }
224
+ else {
225
+ if (teardown instanceof Subscription) {
226
+ if (teardown.closed || teardown._hasParent(this)) {
227
+ return;
228
+ }
229
+ teardown._addParent(this);
230
+ }
231
+ (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
232
+ }
233
+ }
234
+ };
235
+ Subscription.prototype._hasParent = function (parent) {
236
+ var _parentage = this._parentage;
237
+ return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));
238
+ };
239
+ Subscription.prototype._addParent = function (parent) {
240
+ var _parentage = this._parentage;
241
+ this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;
242
+ };
243
+ Subscription.prototype._removeParent = function (parent) {
244
+ var _parentage = this._parentage;
245
+ if (_parentage === parent) {
246
+ this._parentage = null;
247
+ }
248
+ else if (Array.isArray(_parentage)) {
249
+ arrRemove(_parentage, parent);
250
+ }
251
+ };
252
+ Subscription.prototype.remove = function (teardown) {
253
+ var _finalizers = this._finalizers;
254
+ _finalizers && arrRemove(_finalizers, teardown);
255
+ if (teardown instanceof Subscription) {
256
+ teardown._removeParent(this);
257
+ }
258
+ };
259
+ Subscription.EMPTY = (function () {
260
+ var empty = new Subscription();
261
+ empty.closed = true;
262
+ return empty;
263
+ })();
264
+ return Subscription;
265
+ }());
266
+ var EMPTY_SUBSCRIPTION = Subscription.EMPTY;
267
+ function isSubscription(value) {
268
+ return (value instanceof Subscription ||
269
+ (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
270
+ }
271
+ function execFinalizer(finalizer) {
272
+ if (isFunction(finalizer)) {
273
+ finalizer();
274
+ }
275
+ else {
276
+ finalizer.unsubscribe();
277
+ }
278
+ }
279
+
280
+ var config = {
281
+ onUnhandledError: null,
282
+ onStoppedNotification: null,
283
+ Promise: undefined,
284
+ useDeprecatedSynchronousErrorHandling: false,
285
+ useDeprecatedNextContext: false,
286
+ };
287
+
288
+ var timeoutProvider = {
289
+ setTimeout: function (handler, timeout) {
290
+ var args = [];
291
+ for (var _i = 2; _i < arguments.length; _i++) {
292
+ args[_i - 2] = arguments[_i];
293
+ }
294
+ return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
295
+ },
296
+ clearTimeout: function (handle) {
297
+ return (clearTimeout)(handle);
298
+ },
299
+ delegate: undefined,
300
+ };
301
+
302
+ function reportUnhandledError(err) {
303
+ timeoutProvider.setTimeout(function () {
304
+ {
305
+ throw err;
306
+ }
307
+ });
308
+ }
309
+
310
+ function noop() { }
311
+
312
+ function errorContext(cb) {
313
+ {
314
+ cb();
315
+ }
316
+ }
317
+
318
+ var Subscriber = (function (_super) {
319
+ __extends(Subscriber, _super);
320
+ function Subscriber(destination) {
321
+ var _this = _super.call(this) || this;
322
+ _this.isStopped = false;
323
+ if (destination) {
324
+ _this.destination = destination;
325
+ if (isSubscription(destination)) {
326
+ destination.add(_this);
327
+ }
328
+ }
329
+ else {
330
+ _this.destination = EMPTY_OBSERVER;
331
+ }
332
+ return _this;
333
+ }
334
+ Subscriber.create = function (next, error, complete) {
335
+ return new SafeSubscriber(next, error, complete);
336
+ };
337
+ Subscriber.prototype.next = function (value) {
338
+ if (this.isStopped) ;
339
+ else {
340
+ this._next(value);
341
+ }
342
+ };
343
+ Subscriber.prototype.error = function (err) {
344
+ if (this.isStopped) ;
345
+ else {
346
+ this.isStopped = true;
347
+ this._error(err);
348
+ }
349
+ };
350
+ Subscriber.prototype.complete = function () {
351
+ if (this.isStopped) ;
352
+ else {
353
+ this.isStopped = true;
354
+ this._complete();
355
+ }
356
+ };
357
+ Subscriber.prototype.unsubscribe = function () {
358
+ if (!this.closed) {
359
+ this.isStopped = true;
360
+ _super.prototype.unsubscribe.call(this);
361
+ this.destination = null;
362
+ }
363
+ };
364
+ Subscriber.prototype._next = function (value) {
365
+ this.destination.next(value);
366
+ };
367
+ Subscriber.prototype._error = function (err) {
368
+ try {
369
+ this.destination.error(err);
370
+ }
371
+ finally {
372
+ this.unsubscribe();
373
+ }
374
+ };
375
+ Subscriber.prototype._complete = function () {
376
+ try {
377
+ this.destination.complete();
378
+ }
379
+ finally {
380
+ this.unsubscribe();
381
+ }
382
+ };
383
+ return Subscriber;
384
+ }(Subscription));
385
+ var _bind = Function.prototype.bind;
386
+ function bind(fn, thisArg) {
387
+ return _bind.call(fn, thisArg);
388
+ }
389
+ var ConsumerObserver = (function () {
390
+ function ConsumerObserver(partialObserver) {
391
+ this.partialObserver = partialObserver;
392
+ }
393
+ ConsumerObserver.prototype.next = function (value) {
394
+ var partialObserver = this.partialObserver;
395
+ if (partialObserver.next) {
396
+ try {
397
+ partialObserver.next(value);
398
+ }
399
+ catch (error) {
400
+ handleUnhandledError(error);
401
+ }
402
+ }
403
+ };
404
+ ConsumerObserver.prototype.error = function (err) {
405
+ var partialObserver = this.partialObserver;
406
+ if (partialObserver.error) {
407
+ try {
408
+ partialObserver.error(err);
409
+ }
410
+ catch (error) {
411
+ handleUnhandledError(error);
412
+ }
413
+ }
414
+ else {
415
+ handleUnhandledError(err);
416
+ }
417
+ };
418
+ ConsumerObserver.prototype.complete = function () {
419
+ var partialObserver = this.partialObserver;
420
+ if (partialObserver.complete) {
421
+ try {
422
+ partialObserver.complete();
423
+ }
424
+ catch (error) {
425
+ handleUnhandledError(error);
426
+ }
427
+ }
428
+ };
429
+ return ConsumerObserver;
430
+ }());
431
+ var SafeSubscriber = (function (_super) {
432
+ __extends(SafeSubscriber, _super);
433
+ function SafeSubscriber(observerOrNext, error, complete) {
434
+ var _this = _super.call(this) || this;
435
+ var partialObserver;
436
+ if (isFunction(observerOrNext) || !observerOrNext) {
437
+ partialObserver = {
438
+ next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
439
+ error: error !== null && error !== void 0 ? error : undefined,
440
+ complete: complete !== null && complete !== void 0 ? complete : undefined,
441
+ };
442
+ }
443
+ else {
444
+ var context_1;
445
+ if (_this && config.useDeprecatedNextContext) {
446
+ context_1 = Object.create(observerOrNext);
447
+ context_1.unsubscribe = function () { return _this.unsubscribe(); };
448
+ partialObserver = {
449
+ next: observerOrNext.next && bind(observerOrNext.next, context_1),
450
+ error: observerOrNext.error && bind(observerOrNext.error, context_1),
451
+ complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
452
+ };
453
+ }
454
+ else {
455
+ partialObserver = observerOrNext;
456
+ }
457
+ }
458
+ _this.destination = new ConsumerObserver(partialObserver);
459
+ return _this;
460
+ }
461
+ return SafeSubscriber;
462
+ }(Subscriber));
463
+ function handleUnhandledError(error) {
464
+ {
465
+ reportUnhandledError(error);
466
+ }
467
+ }
468
+ function defaultErrorHandler(err) {
469
+ throw err;
470
+ }
471
+ var EMPTY_OBSERVER = {
472
+ closed: true,
473
+ next: noop,
474
+ error: defaultErrorHandler,
475
+ complete: noop,
476
+ };
477
+
478
+ var observable = (function () { return (typeof Symbol === 'function' && Symbol.observable) || '@@observable'; })();
479
+
480
+ function identity(x) {
481
+ return x;
482
+ }
483
+
484
+ function pipeFromArray(fns) {
485
+ if (fns.length === 0) {
486
+ return identity;
487
+ }
488
+ if (fns.length === 1) {
489
+ return fns[0];
490
+ }
491
+ return function piped(input) {
492
+ return fns.reduce(function (prev, fn) { return fn(prev); }, input);
493
+ };
494
+ }
495
+
496
+ var Observable = (function () {
497
+ function Observable(subscribe) {
498
+ if (subscribe) {
499
+ this._subscribe = subscribe;
500
+ }
501
+ }
502
+ Observable.prototype.lift = function (operator) {
503
+ var observable = new Observable();
504
+ observable.source = this;
505
+ observable.operator = operator;
506
+ return observable;
507
+ };
508
+ Observable.prototype.subscribe = function (observerOrNext, error, complete) {
509
+ var _this = this;
510
+ var subscriber = isSubscriber(observerOrNext) ? observerOrNext : new SafeSubscriber(observerOrNext, error, complete);
511
+ errorContext(function () {
512
+ var _a = _this, operator = _a.operator, source = _a.source;
513
+ subscriber.add(operator
514
+ ?
515
+ operator.call(subscriber, source)
516
+ : source
517
+ ?
518
+ _this._subscribe(subscriber)
519
+ :
520
+ _this._trySubscribe(subscriber));
521
+ });
522
+ return subscriber;
523
+ };
524
+ Observable.prototype._trySubscribe = function (sink) {
525
+ try {
526
+ return this._subscribe(sink);
527
+ }
528
+ catch (err) {
529
+ sink.error(err);
530
+ }
531
+ };
532
+ Observable.prototype.forEach = function (next, promiseCtor) {
533
+ var _this = this;
534
+ promiseCtor = getPromiseCtor(promiseCtor);
535
+ return new promiseCtor(function (resolve, reject) {
536
+ var subscriber = new SafeSubscriber({
537
+ next: function (value) {
538
+ try {
539
+ next(value);
540
+ }
541
+ catch (err) {
542
+ reject(err);
543
+ subscriber.unsubscribe();
544
+ }
545
+ },
546
+ error: reject,
547
+ complete: resolve,
548
+ });
549
+ _this.subscribe(subscriber);
550
+ });
551
+ };
552
+ Observable.prototype._subscribe = function (subscriber) {
553
+ var _a;
554
+ return (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber);
555
+ };
556
+ Observable.prototype[observable] = function () {
557
+ return this;
558
+ };
559
+ Observable.prototype.pipe = function () {
560
+ var operations = [];
561
+ for (var _i = 0; _i < arguments.length; _i++) {
562
+ operations[_i] = arguments[_i];
563
+ }
564
+ return pipeFromArray(operations)(this);
565
+ };
566
+ Observable.prototype.toPromise = function (promiseCtor) {
567
+ var _this = this;
568
+ promiseCtor = getPromiseCtor(promiseCtor);
569
+ return new promiseCtor(function (resolve, reject) {
570
+ var value;
571
+ _this.subscribe(function (x) { return (value = x); }, function (err) { return reject(err); }, function () { return resolve(value); });
572
+ });
573
+ };
574
+ Observable.create = function (subscribe) {
575
+ return new Observable(subscribe);
576
+ };
577
+ return Observable;
578
+ }());
579
+ function getPromiseCtor(promiseCtor) {
580
+ var _a;
581
+ return (_a = promiseCtor !== null && promiseCtor !== void 0 ? promiseCtor : config.Promise) !== null && _a !== void 0 ? _a : Promise;
582
+ }
583
+ function isObserver(value) {
584
+ return value && isFunction(value.next) && isFunction(value.error) && isFunction(value.complete);
585
+ }
586
+ function isSubscriber(value) {
587
+ return (value && value instanceof Subscriber) || (isObserver(value) && isSubscription(value));
588
+ }
589
+
590
+ var ObjectUnsubscribedError = createErrorClass(function (_super) {
591
+ return function ObjectUnsubscribedErrorImpl() {
592
+ _super(this);
593
+ this.name = 'ObjectUnsubscribedError';
594
+ this.message = 'object unsubscribed';
595
+ };
596
+ });
597
+
598
+ var Subject = (function (_super) {
599
+ __extends(Subject, _super);
600
+ function Subject() {
601
+ var _this = _super.call(this) || this;
602
+ _this.closed = false;
603
+ _this.currentObservers = null;
604
+ _this.observers = [];
605
+ _this.isStopped = false;
606
+ _this.hasError = false;
607
+ _this.thrownError = null;
608
+ return _this;
609
+ }
610
+ Subject.prototype.lift = function (operator) {
611
+ var subject = new AnonymousSubject(this, this);
612
+ subject.operator = operator;
613
+ return subject;
614
+ };
615
+ Subject.prototype._throwIfClosed = function () {
616
+ if (this.closed) {
617
+ throw new ObjectUnsubscribedError();
618
+ }
619
+ };
620
+ Subject.prototype.next = function (value) {
621
+ var _this = this;
622
+ errorContext(function () {
623
+ var e_1, _a;
624
+ _this._throwIfClosed();
625
+ if (!_this.isStopped) {
626
+ if (!_this.currentObservers) {
627
+ _this.currentObservers = Array.from(_this.observers);
628
+ }
629
+ try {
630
+ for (var _b = __values(_this.currentObservers), _c = _b.next(); !_c.done; _c = _b.next()) {
631
+ var observer = _c.value;
632
+ observer.next(value);
633
+ }
634
+ }
635
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
636
+ finally {
637
+ try {
638
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
639
+ }
640
+ finally { if (e_1) throw e_1.error; }
641
+ }
642
+ }
643
+ });
644
+ };
645
+ Subject.prototype.error = function (err) {
646
+ var _this = this;
647
+ errorContext(function () {
648
+ _this._throwIfClosed();
649
+ if (!_this.isStopped) {
650
+ _this.hasError = _this.isStopped = true;
651
+ _this.thrownError = err;
652
+ var observers = _this.observers;
653
+ while (observers.length) {
654
+ observers.shift().error(err);
655
+ }
656
+ }
657
+ });
658
+ };
659
+ Subject.prototype.complete = function () {
660
+ var _this = this;
661
+ errorContext(function () {
662
+ _this._throwIfClosed();
663
+ if (!_this.isStopped) {
664
+ _this.isStopped = true;
665
+ var observers = _this.observers;
666
+ while (observers.length) {
667
+ observers.shift().complete();
668
+ }
669
+ }
670
+ });
671
+ };
672
+ Subject.prototype.unsubscribe = function () {
673
+ this.isStopped = this.closed = true;
674
+ this.observers = this.currentObservers = null;
675
+ };
676
+ Object.defineProperty(Subject.prototype, "observed", {
677
+ get: function () {
678
+ var _a;
679
+ return ((_a = this.observers) === null || _a === void 0 ? void 0 : _a.length) > 0;
680
+ },
681
+ enumerable: false,
682
+ configurable: true
683
+ });
684
+ Subject.prototype._trySubscribe = function (subscriber) {
685
+ this._throwIfClosed();
686
+ return _super.prototype._trySubscribe.call(this, subscriber);
687
+ };
688
+ Subject.prototype._subscribe = function (subscriber) {
689
+ this._throwIfClosed();
690
+ this._checkFinalizedStatuses(subscriber);
691
+ return this._innerSubscribe(subscriber);
692
+ };
693
+ Subject.prototype._innerSubscribe = function (subscriber) {
694
+ var _this = this;
695
+ var _a = this, hasError = _a.hasError, isStopped = _a.isStopped, observers = _a.observers;
696
+ if (hasError || isStopped) {
697
+ return EMPTY_SUBSCRIPTION;
698
+ }
699
+ this.currentObservers = null;
700
+ observers.push(subscriber);
701
+ return new Subscription(function () {
702
+ _this.currentObservers = null;
703
+ arrRemove(observers, subscriber);
704
+ });
705
+ };
706
+ Subject.prototype._checkFinalizedStatuses = function (subscriber) {
707
+ var _a = this, hasError = _a.hasError, thrownError = _a.thrownError, isStopped = _a.isStopped;
708
+ if (hasError) {
709
+ subscriber.error(thrownError);
710
+ }
711
+ else if (isStopped) {
712
+ subscriber.complete();
713
+ }
714
+ };
715
+ Subject.prototype.asObservable = function () {
716
+ var observable = new Observable();
717
+ observable.source = this;
718
+ return observable;
719
+ };
720
+ Subject.create = function (destination, source) {
721
+ return new AnonymousSubject(destination, source);
722
+ };
723
+ return Subject;
724
+ }(Observable));
725
+ var AnonymousSubject = (function (_super) {
726
+ __extends(AnonymousSubject, _super);
727
+ function AnonymousSubject(destination, source) {
728
+ var _this = _super.call(this) || this;
729
+ _this.destination = destination;
730
+ _this.source = source;
731
+ return _this;
732
+ }
733
+ AnonymousSubject.prototype.next = function (value) {
734
+ var _a, _b;
735
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.next) === null || _b === void 0 ? void 0 : _b.call(_a, value);
736
+ };
737
+ AnonymousSubject.prototype.error = function (err) {
738
+ var _a, _b;
739
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.call(_a, err);
740
+ };
741
+ AnonymousSubject.prototype.complete = function () {
742
+ var _a, _b;
743
+ (_b = (_a = this.destination) === null || _a === void 0 ? void 0 : _a.complete) === null || _b === void 0 ? void 0 : _b.call(_a);
744
+ };
745
+ AnonymousSubject.prototype._subscribe = function (subscriber) {
746
+ var _a, _b;
747
+ return (_b = (_a = this.source) === null || _a === void 0 ? void 0 : _a.subscribe(subscriber)) !== null && _b !== void 0 ? _b : EMPTY_SUBSCRIPTION;
748
+ };
749
+ return AnonymousSubject;
750
+ }(Subject));
751
+
752
+ var dateTimestampProvider = {
753
+ now: function () {
754
+ return (dateTimestampProvider.delegate || Date).now();
755
+ },
756
+ delegate: undefined,
757
+ };
758
+
759
+ var ReplaySubject = (function (_super) {
760
+ __extends(ReplaySubject, _super);
761
+ function ReplaySubject(_bufferSize, _windowTime, _timestampProvider) {
762
+ if (_bufferSize === void 0) { _bufferSize = Infinity; }
763
+ if (_windowTime === void 0) { _windowTime = Infinity; }
764
+ if (_timestampProvider === void 0) { _timestampProvider = dateTimestampProvider; }
765
+ var _this = _super.call(this) || this;
766
+ _this._bufferSize = _bufferSize;
767
+ _this._windowTime = _windowTime;
768
+ _this._timestampProvider = _timestampProvider;
769
+ _this._buffer = [];
770
+ _this._infiniteTimeWindow = true;
771
+ _this._infiniteTimeWindow = _windowTime === Infinity;
772
+ _this._bufferSize = Math.max(1, _bufferSize);
773
+ _this._windowTime = Math.max(1, _windowTime);
774
+ return _this;
775
+ }
776
+ ReplaySubject.prototype.next = function (value) {
777
+ var _a = this, isStopped = _a.isStopped, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow, _timestampProvider = _a._timestampProvider, _windowTime = _a._windowTime;
778
+ if (!isStopped) {
779
+ _buffer.push(value);
780
+ !_infiniteTimeWindow && _buffer.push(_timestampProvider.now() + _windowTime);
781
+ }
782
+ this._trimBuffer();
783
+ _super.prototype.next.call(this, value);
784
+ };
785
+ ReplaySubject.prototype._subscribe = function (subscriber) {
786
+ this._throwIfClosed();
787
+ this._trimBuffer();
788
+ var subscription = this._innerSubscribe(subscriber);
789
+ var _a = this, _infiniteTimeWindow = _a._infiniteTimeWindow, _buffer = _a._buffer;
790
+ var copy = _buffer.slice();
791
+ for (var i = 0; i < copy.length && !subscriber.closed; i += _infiniteTimeWindow ? 1 : 2) {
792
+ subscriber.next(copy[i]);
793
+ }
794
+ this._checkFinalizedStatuses(subscriber);
795
+ return subscription;
796
+ };
797
+ ReplaySubject.prototype._trimBuffer = function () {
798
+ var _a = this, _bufferSize = _a._bufferSize, _timestampProvider = _a._timestampProvider, _buffer = _a._buffer, _infiniteTimeWindow = _a._infiniteTimeWindow;
799
+ var adjustedBufferSize = (_infiniteTimeWindow ? 1 : 2) * _bufferSize;
800
+ _bufferSize < Infinity && adjustedBufferSize < _buffer.length && _buffer.splice(0, _buffer.length - adjustedBufferSize);
801
+ if (!_infiniteTimeWindow) {
802
+ var now = _timestampProvider.now();
803
+ var last = 0;
804
+ for (var i = 1; i < _buffer.length && _buffer[i] <= now; i += 2) {
805
+ last = i;
806
+ }
807
+ last && _buffer.splice(0, last + 1);
808
+ }
809
+ };
810
+ return ReplaySubject;
811
+ }(Subject));
812
+
813
+ /**
814
+ * @license Angular v17.3.10
815
+ * (c) 2010-2024 Google LLC. https://angular.io/
816
+ * License: MIT
817
+ */
818
+
819
+
820
+ /**
821
+ * Exposes the value of an Angular `Signal` as an RxJS `Observable`.
822
+ *
823
+ * The signal's value will be propagated into the `Observable`'s subscribers using an `effect`.
824
+ *
825
+ * `toObservable` must be called in an injection context unless an injector is provided via options.
826
+ *
827
+ * @developerPreview
828
+ */
829
+ function toObservable(source, options) {
830
+ !options?.injector && assertInInjectionContext(toObservable);
831
+ const injector = options?.injector ?? inject(Injector);
832
+ const subject = new ReplaySubject(1);
833
+ const watcher = effect(() => {
834
+ let value;
835
+ try {
836
+ value = source();
837
+ }
838
+ catch (err) {
839
+ untracked(() => subject.error(err));
840
+ return;
841
+ }
842
+ untracked(() => subject.next(value));
843
+ }, { injector, manualCleanup: true });
844
+ injector.get(DestroyRef).onDestroy(() => {
845
+ watcher.destroy();
846
+ subject.complete();
847
+ });
848
+ return subject.asObservable();
849
+ }
850
+
56
851
  const ROOT_SELECTOR = '[data-cy-root]';
57
852
  /**
58
853
  * Gets the root element used to mount the component.
@@ -101,6 +896,7 @@ function setupHooks(optionalCallback) {
101
896
  // @ts-ignore
102
897
  window.Mocha['__zone_patch__'] = false;
103
898
  let activeFixture = null;
899
+ let activeInternalSubscriptions = [];
104
900
  function cleanup() {
105
901
  // Not public, we need to call this to remove the last component from the DOM
106
902
  try {
@@ -108,11 +904,17 @@ function cleanup() {
108
904
  }
109
905
  catch (e) {
110
906
  const notSupportedError = new Error(`Failed to teardown component. The version of Angular you are using may not be officially supported.`);
111
- notSupportedError.docsUrl = 'https://on.cypress.io/component-framework-configuration';
907
+ notSupportedError.docsUrl = 'https://on.cypress.io/frameworks';
112
908
  throw notSupportedError;
113
909
  }
910
+ // clean up internal subscriptions if any exist. We use this for two-way data binding for
911
+ // signal() models
912
+ activeInternalSubscriptions.forEach((subscription) => {
913
+ subscription.unsubscribe();
914
+ });
114
915
  getTestBed().resetTestingModule();
115
916
  activeFixture = null;
917
+ activeInternalSubscriptions = [];
116
918
  }
117
919
  // 'zone.js/testing' is not properly aliasing `it.skip` but it does provide `xit`/`xspecify`
118
920
  // Written up under https://github.com/angular/angular/issues/46297 but is not seeing movement
@@ -190,10 +992,12 @@ function initTestBed(component, config) {
190
992
  getTestBed().overrideProvider(TestComponentRenderer, { useValue: new CypressTestComponentRenderer() });
191
993
  return componentFixture;
192
994
  }
995
+ // if using the Wrapper Component (template strings), the component itself cannot be
996
+ // a standalone component
193
997
  let WrapperComponent = class WrapperComponent {
194
998
  };
195
999
  WrapperComponent = __decorate([
196
- Component({ selector: 'cy-wrapper-component', template: '' })
1000
+ Component({ selector: 'cy-wrapper-component', template: '', standalone: false })
197
1001
  ], WrapperComponent);
198
1002
  /**
199
1003
  * Returns the Component if Type<T> or creates a WrapperComponent
@@ -224,9 +1028,121 @@ function setupFixture(component, config) {
224
1028
  fixture.whenStable().then(() => {
225
1029
  var _a;
226
1030
  fixture.autoDetectChanges((_a = config.autoDetectChanges) !== null && _a !== void 0 ? _a : true);
1031
+ }).catch((e) => {
1032
+ // If this promise does not settle in Angular 19 it is rejected
1033
+ // https://github.com/angular/angular/blob/main/CHANGELOG.md#1900-2024-11-19
1034
+ // eslint-disable-next-line no-console
1035
+ console.error(e);
227
1036
  });
228
1037
  return fixture;
229
1038
  }
1039
+ // Best known way to currently detect whether or not a function is a signal is if the signal symbol exists.
1040
+ // From there, we can take our best guess based on what exists on the object itself.
1041
+ // @see https://github.com/cypress-io/cypress/issues/29731.
1042
+ function isSignal(prop) {
1043
+ try {
1044
+ const symbol = Object.getOwnPropertySymbols(prop).find((symbol) => symbol.toString() === 'Symbol(SIGNAL)');
1045
+ return !!symbol;
1046
+ }
1047
+ catch (e) {
1048
+ // likely a primitive type, object, array, or something else (i.e. not a signal).
1049
+ // We can return false here.
1050
+ return false;
1051
+ }
1052
+ }
1053
+ // currently not a great way to detect if a function is an InputSignal.
1054
+ // @see https://github.com/cypress-io/cypress/issues/29731.
1055
+ function isInputSignal(prop) {
1056
+ return isSignal(prop) && typeof prop === 'function' && prop['name'] === 'inputValueFn';
1057
+ }
1058
+ // currently not a great way to detect if a function is a Model Signal.
1059
+ // @see https://github.com/cypress-io/cypress/issues/29731.
1060
+ function isModelSignal(prop) {
1061
+ return isSignal(prop) && isWritableSignal(prop) && typeof prop.subscribe === 'function';
1062
+ }
1063
+ // currently not a great way to detect if a function is a Writable Signal.
1064
+ // @see https://github.com/cypress-io/cypress/issues/29731.
1065
+ function isWritableSignal(prop) {
1066
+ return isSignal(prop) && typeof prop === 'function' && typeof prop.set === 'function';
1067
+ }
1068
+ function convertPropertyToSignalIfApplicable(propValue, componentValue, injector) {
1069
+ const isComponentValueAnInputSignal = isInputSignal(componentValue);
1070
+ const isComponentValueAModelSignal = isModelSignal(componentValue);
1071
+ let convertedValueIfApplicable = propValue;
1072
+ // If the component has the property defined as an InputSignal, we need to detect whether a non signal value or not was passed into the component as a prop
1073
+ // and attempt to merge the value in correctly.
1074
+ // We don't want to expose the primitive created signal as it should really be one-way binding from within the component.
1075
+ // However, to make CT testing easier, a user can technically pass in a signal to an input component and assert on the signal itself and pass in updates
1076
+ // down to the component as 1 way binding is supported by the test harness
1077
+ if (isComponentValueAnInputSignal) {
1078
+ const isPassedInValueNotASignal = !isSignal(propValue);
1079
+ if (isPassedInValueNotASignal) {
1080
+ // Input signals require an injection context to set initial values.
1081
+ // Because of this, we cannot create them outside the scope of the component.
1082
+ // Options for input signals also don't allow the passing of an injection contexts, so in order to work around this,
1083
+ // we convert the non signal input passed into the input to a writable signal
1084
+ convertedValueIfApplicable = signal(propValue);
1085
+ }
1086
+ // If the component has the property defined as a ModelSignal, we need to detect whether a signal value or not was passed into the component as a prop.
1087
+ // If a non signal property is passed into the component model (primitive, object, array, etc), we need to set the model to that value and propagate changes of that model through the output spy.
1088
+ // Since the non signal type likely lives outside the context of Angular, the non signal type will NOT be updated outside of this context. Instead, the output spy will allow you
1089
+ // to see this change.
1090
+ // If the value passed into the property is in fact a signal, we need to set up two-way binding between the signals to make sure changes from one propagate to the other.
1091
+ }
1092
+ else if (isComponentValueAModelSignal) {
1093
+ const isPassedInValueLikelyARegularSignal = isWritableSignal(propValue);
1094
+ // if the value passed into the component is a signal, set up two-way binding
1095
+ if (isPassedInValueLikelyARegularSignal) {
1096
+ // update the passed in value with the models updates
1097
+ componentValue.subscribe((value) => {
1098
+ propValue.set(value);
1099
+ });
1100
+ // update the model signal with the properties updates
1101
+ const convertedToObservable = toObservable(propValue, {
1102
+ injector,
1103
+ });
1104
+ // push the subscription into an array to be cleaned up at the end of the test
1105
+ // to prevent a memory leak
1106
+ activeInternalSubscriptions.push(convertedToObservable.subscribe((value) => {
1107
+ componentValue.set(value);
1108
+ }));
1109
+ }
1110
+ else {
1111
+ // it's a non signal type, set it as we only need to handle updating the model signal and emit changes on this through the output spy.
1112
+ componentValue.set(propValue);
1113
+ convertedValueIfApplicable = componentValue;
1114
+ }
1115
+ }
1116
+ return convertedValueIfApplicable;
1117
+ }
1118
+ // In the case of signals, if we need to create an output spy, we need to check first whether or not a user has one defined first or has it created through
1119
+ // autoSpyOutputs. If so, we need to subscribe to the writable signal to push updates into the event emitter. We do NOT observe input signals and output spies will not
1120
+ // work for input signals.
1121
+ function detectAndRegisterOutputSpyToSignal(config, component, key, injector) {
1122
+ if (config.componentProperties) {
1123
+ const expectedChangeKey = `${key}Change`;
1124
+ let changeKeyIfExists = !!Object.keys(config.componentProperties).find((componentKey) => componentKey === expectedChangeKey);
1125
+ // since spies do NOT make change handlers by default, similar to the Output() decorator, we need to create the spy and subscribe to the signal
1126
+ if (!changeKeyIfExists && config.autoSpyOutputs) {
1127
+ component[expectedChangeKey] = createOutputSpy(`${expectedChangeKey}Spy`);
1128
+ changeKeyIfExists = true;
1129
+ }
1130
+ if (changeKeyIfExists) {
1131
+ const componentValue = component[key];
1132
+ // if the user passed in a change key or we created one due to config.autoSpyOutputs being set to true for a given signal,
1133
+ // we will create a subscriber that will emit an event every time the value inside the signal changes. We only do this
1134
+ // if the signal is writable and not an input signal.
1135
+ if (isWritableSignal(componentValue) && !isInputSignal(componentValue)) {
1136
+ toObservable(componentValue, {
1137
+ injector,
1138
+ }).subscribe((value) => {
1139
+ var _a;
1140
+ (_a = component[expectedChangeKey]) === null || _a === void 0 ? void 0 : _a.emit(value);
1141
+ });
1142
+ }
1143
+ }
1144
+ }
1145
+ }
230
1146
  /**
231
1147
  * Gets the componentInstance and Object.assigns any componentProperties() passed in the MountConfig
232
1148
  *
@@ -236,7 +1152,22 @@ function setupFixture(component, config) {
236
1152
  */
237
1153
  function setupComponent(config, fixture) {
238
1154
  let component = fixture.componentInstance;
1155
+ const injector = fixture.componentRef.injector;
239
1156
  if (config === null || config === void 0 ? void 0 : config.componentProperties) {
1157
+ // convert primitives to signals if passed in type is a primitive but expected type is signal
1158
+ // a bit of magic. need to move to another function
1159
+ Object.keys(component).forEach((key) => {
1160
+ var _a;
1161
+ // only assign props if they are passed into the component
1162
+ if ((_a = config === null || config === void 0 ? void 0 : config.componentProperties) === null || _a === void 0 ? void 0 : _a.hasOwnProperty(key)) {
1163
+ // @ts-expect-error
1164
+ const passedInValue = config === null || config === void 0 ? void 0 : config.componentProperties[key];
1165
+ const componentValue = component[key];
1166
+ // @ts-expect-error
1167
+ config.componentProperties[key] = convertPropertyToSignalIfApplicable(passedInValue, componentValue, injector);
1168
+ detectAndRegisterOutputSpyToSignal(config, component, key, injector);
1169
+ }
1170
+ });
240
1171
  component = Object.assign(component, config.componentProperties);
241
1172
  }
242
1173
  if (config.autoSpyOutputs) {
@@ -325,6 +1256,15 @@ function mount(component, config = {}) {
325
1256
  * cy.get('[data-cy=increment]').click()
326
1257
  * cy.get('@changeSpy').should('have.been.called')
327
1258
  * })
1259
+ *
1260
+ * // Or for use with Angular Signals following the output nomenclature.
1261
+ * // see https://v17.angular.io/guide/model-inputs#differences-between-model-and-input/
1262
+ *
1263
+ * it('Has spy', () => {
1264
+ * mount(StepperComponent, { componentProperties: { count: signal(0), countChange: createOutputSpy('countChange') } })
1265
+ * cy.get('[data-cy=increment]').click()
1266
+ * cy.get('@countChange').should('have.been.called')
1267
+ * })
328
1268
  */
329
1269
  const createOutputSpy = (alias) => {
330
1270
  const emitter = new EventEmitter();