cypress 16.2.0 → 16.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/angular/dist/index.js +10 -12
  2. package/angular/package.json +7 -22
  3. package/dist/bin/cypress +8 -8
  4. package/dist/{cli-AgTnS5LO.js → cli-y9Bb9Y77.js} +215 -40
  5. package/dist/cli.js +6 -6
  6. package/dist/{cypress-CdDm9AVa.js → cypress-CvEs5adm.js} +2 -2
  7. package/dist/cypress.js +8 -8
  8. package/dist/exec/spawn.js +4 -4
  9. package/dist/exec/xvfb.js +7 -4
  10. package/dist/index.js +8 -8
  11. package/dist/{spawn-DElwyZHC.js → spawn-Bx99tBTm.js} +529 -69
  12. package/dist/{tap-WHD3nHJC.js → tap-BMFGLoCT.js} +108 -26
  13. package/dist/{xvfb-CbW2_YXR.js → xvfb-DxbcANVl.js} +238 -25
  14. package/mount-utils/dist/index.js +1 -1
  15. package/mount-utils/package.json +15 -14
  16. package/package.json +5 -5
  17. package/react/dist/cypress-react.cjs.js +9 -7
  18. package/react/dist/cypress-react.esm-bundler.js +9 -7
  19. package/react/package.json +26 -46
  20. package/svelte/dist/cypress-svelte.cjs.js +3 -2
  21. package/svelte/dist/cypress-svelte.esm-bundler.js +3 -2
  22. package/svelte/package.json +24 -22
  23. package/types/cy-bluebird.d.ts +1 -0
  24. package/types/cy-chai.d.ts +99 -2
  25. package/types/cypress.d.ts +216 -43
  26. package/types/net-stubbing.d.ts +1 -1
  27. package/vue/dist/cypress-vue.cjs.js +4 -2
  28. package/vue/dist/cypress-vue.esm-bundler.js +4 -2
  29. package/vue/dist/index.d.ts +3 -3
  30. package/vue/package.json +35 -42
  31. package/angular/angular/README.md +0 -18
  32. package/angular/angular/dist/index.d.ts +0 -120
  33. package/angular/angular/dist/index.js +0 -479
  34. package/angular/angular/package.json +0 -82
  35. package/mount-utils/mount-utils/README.md +0 -140
  36. package/mount-utils/mount-utils/dist/index.d.ts +0 -12
  37. package/mount-utils/mount-utils/dist/index.js +0 -41
  38. package/mount-utils/mount-utils/package.json +0 -52
  39. package/react/react/README.md +0 -19
  40. package/react/react/dist/cypress-react.cjs.js +0 -293
  41. package/react/react/dist/cypress-react.esm-bundler.js +0 -268
  42. package/react/react/dist/index.d.ts +0 -95
  43. package/react/react/package.json +0 -113
  44. package/svelte/svelte/README.md +0 -19
  45. package/svelte/svelte/dist/cypress-svelte.cjs.js +0 -122
  46. package/svelte/svelte/dist/cypress-svelte.esm-bundler.js +0 -120
  47. package/svelte/svelte/dist/index.d.ts +0 -31
  48. package/svelte/svelte/package.json +0 -63
  49. package/vue/vue/README.md +0 -14
  50. package/vue/vue/dist/cypress-vue.cjs.js +0 -8692
  51. package/vue/vue/dist/cypress-vue.esm-bundler.js +0 -8671
  52. package/vue/vue/dist/index.d.ts +0 -1413
  53. package/vue/vue/package.json +0 -97
@@ -1,479 +0,0 @@
1
-
2
- /**
3
- * @cypress/angular v0.0.0-development
4
- * (c) 2026 Cypress.io
5
- * Released under the MIT License
6
- */
7
-
8
- import { CommonModule } from '@angular/common';
9
- import { Injectable, Component, EventEmitter, ErrorHandler, provideZonelessChangeDetection, SimpleChange } from '@angular/core';
10
- import { toObservable } from '@angular/core/rxjs-interop';
11
- import { getTestBed, TestComponentRenderer, TestBed } from '@angular/core/testing';
12
- import { BrowserTestingModule, platformBrowserTesting } from '@angular/platform-browser/testing';
13
-
14
- /******************************************************************************
15
- Copyright (c) Microsoft Corporation.
16
-
17
- Permission to use, copy, modify, and/or distribute this software for any
18
- purpose with or without fee is hereby granted.
19
-
20
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
21
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
22
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
23
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
24
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
25
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
26
- PERFORMANCE OF THIS SOFTWARE.
27
- ***************************************************************************** */
28
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
29
-
30
-
31
- function __rest(s, e) {
32
- var t = {};
33
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
34
- t[p] = s[p];
35
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
36
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
37
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
38
- t[p[i]] = s[p[i]];
39
- }
40
- return t;
41
- }
42
-
43
- function __decorate(decorators, target, key, desc) {
44
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
45
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
46
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
47
- return c > 3 && r && Object.defineProperty(target, key, r), r;
48
- }
49
-
50
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
51
- var e = new Error(message);
52
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
53
- };
54
-
55
- const ROOT_SELECTOR = '[data-cy-root]';
56
- /**
57
- * Gets the root element used to mount the component.
58
- * @returns {HTMLElement} The root element
59
- * @throws {Error} If the root element is not found
60
- */
61
- const getContainerEl = () => {
62
- const el = document.querySelector(ROOT_SELECTOR);
63
- if (el) {
64
- return el;
65
- }
66
- 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.`);
67
- };
68
- /**
69
- * Utility function to register CT side effects and run cleanup code during the "test:before:run" Cypress hook
70
- * @param optionalCallback Callback to be called before the next test runs
71
- */
72
- function setupHooks(optionalCallback) {
73
- // We don't want CT side effects to run when e2e
74
- // testing so we early return.
75
- // System test to verify CT side effects do not pollute e2e: system-tests/test/e2e_with_mount_import_spec.ts
76
- if (Cypress.testingType !== 'component') {
77
- return;
78
- }
79
- // When running component specs, we cannot allow "cy.visit"
80
- // because it will wipe out our preparation work, and does not make much sense
81
- // thus we overwrite "cy.visit" to throw an error
82
- Cypress.Commands.overwrite('visit', () => {
83
- throw new Error('cy.visit from a component spec is not allowed');
84
- });
85
- Cypress.Commands.overwrite('session', () => {
86
- throw new Error('cy.session from a component spec is not allowed');
87
- });
88
- Cypress.Commands.overwrite('origin', () => {
89
- throw new Error('cy.origin from a component spec is not allowed');
90
- });
91
- // @ts-ignore
92
- Cypress.on('test:before:after:run:async', () => {
93
- optionalCallback?.();
94
- });
95
- }
96
-
97
- let activeFixture = null;
98
- let activeInternalSubscriptions = [];
99
- function cleanup() {
100
- // Not public, we need to call this to remove the last component from the DOM
101
- try {
102
- getTestBed().tearDownTestingModule();
103
- }
104
- catch (e) {
105
- const notSupportedError = new Error(`Failed to teardown component. The version of Angular you are using may not be officially supported.`);
106
- notSupportedError.docsUrl = 'https://on.cypress.io/frameworks';
107
- throw notSupportedError;
108
- }
109
- // clean up internal subscriptions if any exist. We use this for two-way data binding for
110
- // signal() models
111
- activeInternalSubscriptions.forEach((subscription) => {
112
- subscription.unsubscribe();
113
- });
114
- getTestBed().resetTestingModule();
115
- activeFixture = null;
116
- activeInternalSubscriptions = [];
117
- }
118
- let CypressAngularErrorHandler = class CypressAngularErrorHandler {
119
- handleError(error) {
120
- throw error;
121
- }
122
- };
123
- CypressAngularErrorHandler = __decorate([
124
- Injectable()
125
- ], CypressAngularErrorHandler);
126
- /**
127
- * Bootstraps the TestModuleMetaData passed to the TestBed
128
- *
129
- * @param {Type<T>} component Angular component being mounted
130
- * @param {MountConfig} config TestBed configuration passed into the mount function
131
- * @returns {MountConfig} MountConfig
132
- */
133
- function bootstrapModule(component, config) {
134
- var _a;
135
- const { componentProperties } = config, testModuleMetaData = __rest(config, ["componentProperties"]);
136
- if (!testModuleMetaData.declarations) {
137
- testModuleMetaData.declarations = [];
138
- }
139
- if (!testModuleMetaData.imports) {
140
- testModuleMetaData.imports = [];
141
- }
142
- if (!testModuleMetaData.providers) {
143
- testModuleMetaData.providers = [];
144
- }
145
- // Replace default error handler since it will swallow uncaught exceptions.
146
- // We want these to be uncaught so Cypress catches it and fails the test
147
- testModuleMetaData.providers.push({
148
- provide: ErrorHandler,
149
- useClass: CypressAngularErrorHandler,
150
- });
151
- // allow for zoneless change detection inside the testing module.
152
- // @see https://angular.dev/guide/zoneless#using-zoneless-in-testbed
153
- testModuleMetaData.providers.push(provideZonelessChangeDetection());
154
- // check if the component is a standalone component
155
- if ((_a = component.ɵcmp) === null || _a === void 0 ? void 0 : _a.standalone) {
156
- testModuleMetaData.imports.push(component);
157
- }
158
- else {
159
- testModuleMetaData.declarations.push(component);
160
- }
161
- if (!testModuleMetaData.imports.includes(CommonModule)) {
162
- testModuleMetaData.imports.push(CommonModule);
163
- }
164
- return testModuleMetaData;
165
- }
166
- let CypressTestComponentRenderer = class CypressTestComponentRenderer extends TestComponentRenderer {
167
- insertRootElement(rootElId) {
168
- this.removeAllRootElements();
169
- const rootElement = getContainerEl();
170
- rootElement.setAttribute('id', rootElId);
171
- }
172
- removeAllRootElements() {
173
- getContainerEl().innerHTML = '';
174
- }
175
- };
176
- CypressTestComponentRenderer = __decorate([
177
- Injectable()
178
- ], CypressTestComponentRenderer);
179
- /**
180
- * Initializes the TestBed
181
- *
182
- * @param {Type<T> | string} component Angular component being mounted or its template
183
- * @param {MountConfig} config TestBed configuration passed into the mount function
184
- * @returns {Type<T>} componentFixture
185
- */
186
- function initTestBed(component, config) {
187
- const componentFixture = createComponentFixture(component);
188
- getTestBed().configureTestingModule(Object.assign({}, bootstrapModule(componentFixture, config)));
189
- getTestBed().overrideProvider(TestComponentRenderer, { useValue: new CypressTestComponentRenderer() });
190
- return componentFixture;
191
- }
192
- // if using the Wrapper Component (template strings), the component itself cannot be
193
- // a standalone component
194
- let WrapperComponent = class WrapperComponent {
195
- };
196
- WrapperComponent = __decorate([
197
- Component({ selector: 'cy-wrapper-component', template: '', standalone: false })
198
- ], WrapperComponent);
199
- /**
200
- * Returns the Component if Type<T> or creates a WrapperComponent
201
- *
202
- * @param {Type<T> | string} component The component you want to create a fixture of
203
- * @returns {Type<T> | WrapperComponent}
204
- */
205
- function createComponentFixture(component) {
206
- if (typeof component === 'string') {
207
- // getTestBed().overrideTemplate is available in v14+
208
- // The static TestBed.overrideTemplate is available across versions
209
- TestBed.overrideTemplate(WrapperComponent, component);
210
- return WrapperComponent;
211
- }
212
- return component;
213
- }
214
- /**
215
- * Creates the ComponentFixture
216
- *
217
- * @param {Type<T>} component Angular component being mounted
218
- * @param {MountConfig<T>} config MountConfig
219
-
220
- * @returns {Promise<ComponentFixture<T>>} ComponentFixture
221
- */
222
- function setupFixture(component, config) {
223
- const fixture = getTestBed().createComponent(component);
224
- setupComponent(config, fixture);
225
- return fixture;
226
- }
227
- // Best known way to currently detect whether or not a function is a signal is if the signal symbol exists.
228
- // From there, we can take our best guess based on what exists on the object itself.
229
- // @see https://github.com/cypress-io/cypress/issues/29731.
230
- function isSignal(prop) {
231
- try {
232
- const symbol = Object.getOwnPropertySymbols(prop).find((symbol) => symbol.toString() === 'Symbol(SIGNAL)');
233
- return !!symbol;
234
- }
235
- catch (e) {
236
- // likely a primitive type, object, array, or something else (i.e. not a signal).
237
- // We can return false here.
238
- return false;
239
- }
240
- }
241
- // currently not a great way to detect if a function is an InputSignal.
242
- // @see https://github.com/cypress-io/cypress/issues/29731.
243
- function isInputSignal(prop) {
244
- return isSignal(prop) && typeof prop === 'function' && prop['name'] === 'inputValueFn';
245
- }
246
- // currently not a great way to detect if a function is a Model Signal.
247
- // @see https://github.com/cypress-io/cypress/issues/29731.
248
- function isModelSignal(prop) {
249
- return isSignal(prop) && isWritableSignal(prop) && typeof prop.subscribe === 'function';
250
- }
251
- // currently not a great way to detect if a function is a Writable Signal.
252
- // @see https://github.com/cypress-io/cypress/issues/29731.
253
- function isWritableSignal(prop) {
254
- return isSignal(prop) && typeof prop === 'function' && typeof prop.set === 'function';
255
- }
256
- function registerSignalEventsIfNeeded(propKey, propValue, componentValue, injector, fixture) {
257
- const isPropValueASignal = isSignal(propValue);
258
- if (isPropValueASignal) {
259
- // propValue -> componentValue
260
- const convertedToObservable = toObservable(propValue, {
261
- injector,
262
- });
263
- // push the subscription into an array to be cleaned up at the end of the test
264
- // to prevent a memory leak
265
- activeInternalSubscriptions.push(convertedToObservable.subscribe((value) => {
266
- // keep the component up to date as prop signal changes
267
- fixture.componentRef.setInput(propKey, value);
268
- }));
269
- }
270
- const isComponentValueAModelSignal = isModelSignal(componentValue);
271
- if (isPropValueASignal && isComponentValueAModelSignal) {
272
- // propValue <- componentValue
273
- const modelChanged$ = toObservable(componentValue, {
274
- injector,
275
- });
276
- activeInternalSubscriptions.push(modelChanged$.subscribe((value) => {
277
- propValue.set(value);
278
- }));
279
- }
280
- }
281
- // 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
282
- // 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
283
- // work for input signals.
284
- function detectAndRegisterOutputSpyToSignal(config, component, key, injector) {
285
- if (config.componentProperties) {
286
- const expectedChangeKey = `${key}Change`;
287
- let changeKeyIfExists = !!Object.keys(config.componentProperties).find((componentKey) => componentKey === expectedChangeKey);
288
- if (changeKeyIfExists) {
289
- component[expectedChangeKey] =
290
- // @ts-expect-error
291
- config.componentProperties[expectedChangeKey];
292
- }
293
- if (changeKeyIfExists) {
294
- const componentValue = component[key];
295
- // if the user passed in a change key or we created one due to config.autoSpyOutputs being set to true for a given signal,
296
- // we will create a subscriber that will emit an event every time the value inside the signal changes. We only do this
297
- // if the signal is writable and not an input signal.
298
- if (isWritableSignal(componentValue) && !isInputSignal(componentValue)) {
299
- activeInternalSubscriptions.push(toObservable(componentValue, {
300
- injector,
301
- }).subscribe((value) => {
302
- var _a;
303
- (_a = component[expectedChangeKey]) === null || _a === void 0 ? void 0 : _a.emit(value);
304
- }));
305
- }
306
- }
307
- }
308
- }
309
- /**
310
- * Gets the componentInstance and Object.assigns any componentProperties() passed in the MountConfig
311
- *
312
- * @param {MountConfig} config TestBed configuration passed into the mount function
313
- * @param {ComponentFixture<T>} fixture Fixture for debugging and testing a component.
314
- * @returns {T} Component being mounted
315
- */
316
- function setupComponent(config, fixture) {
317
- let component = fixture.componentInstance;
318
- const injector = fixture.componentRef.injector;
319
- if (config === null || config === void 0 ? void 0 : config.componentProperties) {
320
- if (component instanceof WrapperComponent) {
321
- component = Object.assign(component, config.componentProperties);
322
- }
323
- getComponentInputs(fixture.componentRef.componentType).forEach((key) => {
324
- var _a;
325
- // only assign props if they are passed into the component
326
- if ((_a = config === null || config === void 0 ? void 0 : config.componentProperties) === null || _a === void 0 ? void 0 : _a.hasOwnProperty(key)) {
327
- // @ts-expect-error
328
- const passedInValue = config === null || config === void 0 ? void 0 : config.componentProperties[key];
329
- registerSignalEventsIfNeeded(key, passedInValue, component[key], injector, fixture);
330
- detectAndRegisterOutputSpyToSignal(config, component, key, injector);
331
- fixture.componentRef.setInput(key, isSignal(passedInValue) ? passedInValue() : passedInValue);
332
- }
333
- });
334
- getComponentOutputs(fixture.componentRef.componentType).forEach((key) => {
335
- var _a, _b;
336
- const property = component[key];
337
- // With the introduction of https://github.com/cypress-io/cypress/pull/31993, we want to make sure that component inputs are reference safe inside cy.mount().
338
- // However, the exception to this is if the user passes in a Cypress output spy as a property in order to maintain backwards compatibility.
339
- // @ts-expect-error
340
- if (property instanceof EventEmitter || (((_a = config === null || config === void 0 ? void 0 : config.componentProperties) === null || _a === void 0 ? void 0 : _a.hasOwnProperty(key)) && (config === null || config === void 0 ? void 0 : config.componentProperties[key]) instanceof EventEmitter)) {
341
- // only assign props if they are passed into the component
342
- if ((_b = config === null || config === void 0 ? void 0 : config.componentProperties) === null || _b === void 0 ? void 0 : _b.hasOwnProperty(key)) {
343
- // @ts-expect-error
344
- const passedInValue = config === null || config === void 0 ? void 0 : config.componentProperties[key];
345
- component[key] = passedInValue;
346
- }
347
- }
348
- });
349
- }
350
- // Manually call ngOnChanges when mounting components using the class syntax.
351
- // This is necessary because we are assigning input values to the class directly
352
- // on mount and therefore the ngOnChanges() lifecycle is not triggered.
353
- if (component.ngOnChanges && config.componentProperties) {
354
- const { componentProperties } = config;
355
- const simpleChanges = Object.entries(componentProperties).reduce((acc, [key, value]) => {
356
- acc[key] = new SimpleChange(null, value, true);
357
- return acc;
358
- }, {});
359
- if (Object.keys(componentProperties).length > 0) {
360
- component.ngOnChanges(simpleChanges);
361
- }
362
- }
363
- }
364
- /**
365
- * Gets the input properties of a component - cannot rely on Object.keys() because inclusion of optional properties depends on useDefineForClassFields=true
366
- * Since Angular 15, useDefineForClassFields=false
367
- * @param componentType
368
- * @returns array of input property names
369
- */
370
- function getComponentInputs(componentType) {
371
- var _a;
372
- // Access Angular's metadata to get input properties
373
- const propMetadata = ((_a = componentType.ɵcmp) === null || _a === void 0 ? void 0 : _a.inputs) || {};
374
- return Object.keys(propMetadata);
375
- }
376
- function getComponentOutputs(componentType) {
377
- var _a;
378
- // Access Angular's metadata to get output properties
379
- const propMetadata = ((_a = componentType.ɵcmp) === null || _a === void 0 ? void 0 : _a.outputs) || {};
380
- return Object.keys(propMetadata);
381
- }
382
- /**
383
- * Mounts an Angular component inside Cypress browser
384
- *
385
- * @param component Angular component being mounted or its template
386
- * @param config configuration used to configure the TestBed
387
- * @example
388
- * import { mount } from '@cypress/angular'
389
- * import { StepperComponent } from './stepper.component'
390
- * import { MyService } from 'services/my.service'
391
- * import { SharedModule } from 'shared/shared.module';
392
- * it('mounts', () => {
393
- * mount(StepperComponent, {
394
- * providers: [MyService],
395
- * imports: [SharedModule]
396
- * })
397
- * cy.get('[data-cy=increment]').click()
398
- * cy.get('[data-cy=counter]').should('have.text', '1')
399
- * })
400
- *
401
- * // or
402
- *
403
- * it('mounts with template', () => {
404
- * mount('<app-stepper></app-stepper>', {
405
- * declarations: [StepperComponent],
406
- * })
407
- * })
408
- *
409
- * @see {@link https://on.cypress.io/mounting-angular} for more details.
410
- *
411
- * @returns A component and component fixture
412
- */
413
- function mount(component, config = {}) {
414
- // Remove last mounted component if cy.mount is called more than once in a test
415
- if (activeFixture) {
416
- cleanup();
417
- }
418
- const componentFixture = initTestBed(component, config);
419
- let mountResponsePromiseResolver;
420
- let mountResponsePromiseRejector;
421
- let mountResponsePromise = new Promise((resolve, reject) => {
422
- mountResponsePromiseResolver = resolve;
423
- mountResponsePromiseRejector = reject;
424
- });
425
- const fixture = setupFixture(componentFixture, config);
426
- activeFixture = fixture;
427
- fixture.whenStable().then(() => {
428
- const mountResponse = {
429
- fixture,
430
- component: fixture.componentInstance,
431
- };
432
- const logMessage = typeof component === 'string' ? 'Component' : componentFixture.name;
433
- Cypress.log({
434
- name: 'mount',
435
- message: logMessage,
436
- consoleProps: () => ({ result: mountResponse }),
437
- });
438
- mountResponsePromiseResolver(mountResponse);
439
- }).catch((error) => {
440
- mountResponsePromiseRejector(error);
441
- });
442
- return cy.wrap(mountResponsePromise, { log: false });
443
- }
444
- /**
445
- * Creates a new Event Emitter and then spies on it's `emit` method
446
- *
447
- * @param {string} alias name you want to use for your cy.spy() alias
448
- * @returns EventEmitter<T>
449
- * @example
450
- * import { StepperComponent } from './stepper.component'
451
- * import { mount, createOutputSpy } from '@cypress/angular'
452
- *
453
- * it('Has spy', () => {
454
- * mount(StepperComponent, { componentProperties: { change: createOutputSpy('changeSpy') } })
455
- * cy.get('[data-cy=increment]').click()
456
- * cy.get('@changeSpy').should('have.been.called')
457
- * })
458
- *
459
- * // Or for use with Angular Signals following the output nomenclature.
460
- * // see https://v17.angular.io/guide/model-inputs#differences-between-model-and-input/
461
- *
462
- * it('Has spy', () => {
463
- * mount(StepperComponent, { componentProperties: { count: signal(0), countChange: createOutputSpy('countChange') } })
464
- * cy.get('[data-cy=increment]').click()
465
- * cy.get('@countChange').should('have.been.called')
466
- * })
467
- */
468
- const createOutputSpy = (alias) => {
469
- const emitter = new EventEmitter();
470
- cy.spy(emitter, 'emit').as(alias);
471
- return emitter;
472
- };
473
- // Only needs to run once, we reset before each test
474
- getTestBed().initTestEnvironment(BrowserTestingModule, platformBrowserTesting(), {
475
- teardown: { destroyAfterEach: false },
476
- });
477
- setupHooks(cleanup);
478
-
479
- export { CypressTestComponentRenderer, createOutputSpy, mount };
@@ -1,82 +0,0 @@
1
- {
2
- "name": "@cypress/angular",
3
- "version": "0.0.0-development",
4
- "description": "Test Angular Components with Cypress",
5
- "main": "dist/index.js",
6
- "scripts": {
7
- "prebuild": "rimraf dist",
8
- "build": "rollup -c rollup.config.mjs",
9
- "postbuild": "node ../../scripts/sync-exported-npm-with-cli.js",
10
- "check-ts": "tsc --noEmit",
11
- "dev": "rollup -c rollup.config.mjs -w",
12
- "lint": "eslint --ext .js,.ts,.json, ."
13
- },
14
- "dependencies": {},
15
- "devDependencies": {
16
- "@angular/common": "^21.0.0",
17
- "@angular/core": "^21.0.0",
18
- "@angular/platform-browser": "^21.0.0",
19
- "@cypress/mount-utils": "0.0.0-development",
20
- "rollup": "^4.60.2",
21
- "typescript": "~5.9.2"
22
- },
23
- "peerDependencies": {
24
- "@angular/common": ">=21.0.0",
25
- "@angular/core": ">=21.0.0",
26
- "@angular/platform-browser": ">=21.0.0",
27
- "rxjs": ">=7.8.0"
28
- },
29
- "files": [
30
- "dist"
31
- ],
32
- "types": "dist/index.d.ts",
33
- "license": "MIT",
34
- "repository": {
35
- "type": "git",
36
- "url": "https://github.com/cypress-io/cypress.git"
37
- },
38
- "homepage": "https://github.com/cypress-io/cypress/blob/develop/npm/angular/#readme",
39
- "bugs": "https://github.com/cypress-io/cypress/issues/new?assignees=&labels=npm%3A%20%40cypress%2Fangular&template=1-bug-report.md&title=",
40
- "keywords": [
41
- "angular",
42
- "cypress",
43
- "cypress-io",
44
- "test",
45
- "testing",
46
- "zoneless"
47
- ],
48
- "contributors": [
49
- {
50
- "name": "Bill Glesias",
51
- "social": "@atofstryker"
52
- },
53
- {
54
- "name": "Jordan Powell",
55
- "social": "@jordanpowell88"
56
- },
57
- {
58
- "name": "Zach Williams",
59
- "social": "@ZachJW34"
60
- }
61
- ],
62
- "module": "dist/index.js",
63
- "publishConfig": {
64
- "access": "public"
65
- },
66
- "nx": {
67
- "targets": {
68
- "build": {
69
- "outputs": [
70
- "{workspaceRoot}/cli/angular"
71
- ]
72
- }
73
- }
74
- },
75
- "standard": {
76
- "globals": [
77
- "Cypress",
78
- "cy",
79
- "expect"
80
- ]
81
- }
82
- }