cypress 10.3.1 → 10.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. package/lib/exec/open.js +6 -0
  2. package/mount-utils/CHANGELOG.md +0 -1
  3. package/mount-utils/README.md +7 -0
  4. package/package.json +10 -5
  5. package/react/CHANGELOG.md +0 -19
  6. package/react/README.md +28 -323
  7. package/react/dist/createMount.d.ts +30 -0
  8. package/react/dist/cypress-react.cjs.js +59 -78
  9. package/react/dist/cypress-react.esm-bundler.js +51 -74
  10. package/react/dist/getDisplayName.d.ts +1 -1
  11. package/react/dist/index.d.ts +2 -0
  12. package/react/dist/mount.d.ts +5 -141
  13. package/react/dist/types.d.ts +50 -0
  14. package/react/package.json +1 -5
  15. package/react18/dist/cypress-react.cjs.js +422 -0
  16. package/react18/dist/cypress-react.esm-bundler.js +394 -0
  17. package/react18/dist/index.d.ts +5 -0
  18. package/react18/package.json +59 -0
  19. package/types/cypress.d.ts +9 -0
  20. package/types/index.d.ts +1 -1
  21. package/types/{net-stubbing.ts → net-stubbing.d.ts} +0 -0
  22. package/vue/CHANGELOG.md +2 -17
  23. package/vue/README.md +17 -608
  24. package/vue/dist/@vue/test-utils/baseWrapper.d.ts +3 -1
  25. package/vue/dist/@vue/test-utils/config.d.ts +4 -2
  26. package/vue/dist/@vue/test-utils/emit.d.ts +1 -0
  27. package/vue/dist/@vue/test-utils/index.d.ts +2 -1
  28. package/vue/dist/@vue/test-utils/interfaces/wrapperLike.d.ts +2 -2
  29. package/vue/dist/@vue/test-utils/mount.d.ts +2 -0
  30. package/vue/dist/@vue/test-utils/stubs.d.ts +2 -6
  31. package/vue/dist/@vue/test-utils/types.d.ts +1 -1
  32. package/vue/dist/@vue/test-utils/vueWrapper.d.ts +2 -1
  33. package/vue/dist/cypress-vue.cjs.js +5379 -5090
  34. package/vue/dist/cypress-vue.esm-bundler.js +5380 -5091
  35. package/vue/dist/index.d.ts +1 -0
  36. package/vue/package.json +2 -2
  37. package/vue2/README.md +11 -627
  38. package/vue2/dist/cypress-vue2.browser.js +251 -260
  39. package/vue2/dist/cypress-vue2.cjs.js +250 -259
  40. package/vue2/dist/cypress-vue2.esm-bundler.js +248 -257
  41. package/react/dist/cypress-react.browser.js +0 -512
@@ -1,9 +1,11 @@
1
- import { GlobalMountOptions } from './types';
1
+ import { GlobalMountOptions, Stub } from './types';
2
2
  import { VueWrapper } from './vueWrapper';
3
3
  import { DOMWrapper } from './domWrapper';
4
4
  import { CustomCreateStub } from './stubs';
5
5
  export interface GlobalConfigOptions {
6
- global: Required<GlobalMountOptions>;
6
+ global: Required<Omit<GlobalMountOptions, 'stubs'>> & {
7
+ stubs: Record<string, Stub>;
8
+ };
7
9
  plugins: {
8
10
  VueWrapper: Pluggable<VueWrapper>;
9
11
  DOMWrapper: Pluggable<DOMWrapper<Node>>;
@@ -2,3 +2,4 @@ import { ComponentPublicInstance, ComponentInternalInstance } from 'vue';
2
2
  export declare function emitted<T = unknown>(vm: ComponentPublicInstance, eventName?: string): undefined | T[] | Record<string, T[]>;
3
3
  export declare const attachEmitListener: () => void;
4
4
  export declare const recordEvent: (vm: ComponentInternalInstance, event: string, args: unknown[]) => void;
5
+ export declare const removeEventHistory: (vm: ComponentPublicInstance) => void;
@@ -1,5 +1,6 @@
1
1
  import { DOMWrapper } from './domWrapper';
2
2
  import { VueWrapper } from './vueWrapper';
3
+ import BaseWrapper from './baseWrapper';
3
4
  import { mount, shallowMount } from './mount';
4
5
  import { MountingOptions } from './types';
5
6
  import { RouterLinkStub } from './components/RouterLinkStub';
@@ -7,4 +8,4 @@ import { createWrapperError } from './errorWrapper';
7
8
  import { config } from './config';
8
9
  import { flushPromises } from './utils/flushPromises';
9
10
  import { enableAutoUnmount, disableAutoUnmount } from './utils/autoUnmount';
10
- export { mount, shallowMount, enableAutoUnmount, disableAutoUnmount, RouterLinkStub, VueWrapper, DOMWrapper, config, flushPromises, MountingOptions, createWrapperError };
11
+ export { mount, shallowMount, enableAutoUnmount, disableAutoUnmount, RouterLinkStub, VueWrapper, DOMWrapper, BaseWrapper, config, flushPromises, MountingOptions, createWrapperError };
@@ -1,5 +1,5 @@
1
- import { DomEventNameWithModifier } from 'src/constants/dom-events';
2
- import { TriggerOptions } from 'src/createDomEvent';
1
+ import { DomEventNameWithModifier } from '../constants/dom-events';
2
+ import { TriggerOptions } from '../createDomEvent';
3
3
  import { DefinedComponent, FindAllComponentsSelector, FindComponentSelector, NameSelector, RefSelector } from '../types';
4
4
  import { VueWrapper } from '../vueWrapper';
5
5
  import { ComponentPublicInstance, FunctionalComponent } from 'vue';
@@ -2,6 +2,7 @@ import { FunctionalComponent, ComponentPublicInstance, ComponentOptionsWithObjec
2
2
  import { MountingOptions } from './types';
3
3
  import { VueWrapper } from './vueWrapper';
4
4
  declare type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
5
+ declare type ComponentMountingOptions<T> = T extends DefineComponent<infer PropsOrPropOptions, any, infer D, any, any> ? MountingOptions<Partial<ExtractDefaultPropTypes<PropsOrPropOptions>> & Omit<Readonly<ExtractPropTypes<PropsOrPropOptions>> & PublicProps, keyof ExtractDefaultPropTypes<PropsOrPropOptions>>, D> & Record<string, any> : MountingOptions<any>;
5
6
  export declare function mount<V>(originalComponent: {
6
7
  new (...args: any[]): V;
7
8
  __vccOpts: any;
@@ -22,6 +23,7 @@ export declare function mount<V, P>(originalComponent: {
22
23
  }, options?: MountingOptions<P & PublicProps> & Record<string, any>): VueWrapper<ComponentPublicInstance<V>>;
23
24
  export declare function mount<Props, E extends EmitsOptions = {}>(originalComponent: FunctionalComponent<Props, E>, options?: MountingOptions<Props & PublicProps> & Record<string, any>): VueWrapper<ComponentPublicInstance<Props>>;
24
25
  export declare function mount<PropsOrPropOptions = {}, RawBindings = {}, D = {}, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = Record<string, any>, EE extends string = string, PP = PublicProps, Props = Readonly<ExtractPropTypes<PropsOrPropOptions>>, Defaults = ExtractDefaultPropTypes<PropsOrPropOptions>>(component: DefineComponent<PropsOrPropOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, PP, Props, Defaults>, options?: MountingOptions<Partial<Defaults> & Omit<Props & PublicProps, keyof Defaults>, D> & Record<string, any>): VueWrapper<InstanceType<DefineComponent<PropsOrPropOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, PP, Props, Defaults>>>;
26
+ export declare function mount<T extends DefineComponent<any, any, any, any>>(component: T, options?: ComponentMountingOptions<T>): VueWrapper<InstanceType<T>>;
25
27
  export declare function mount<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends Record<string, Function> = {}, E extends EmitsOptions = Record<string, any>, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, EE extends string = string>(componentOptions: ComponentOptionsWithoutProps<Props, RawBindings, D, C, M, E, Mixin, Extends, EE>, options?: MountingOptions<Props & PublicProps, D>): VueWrapper<ComponentPublicInstance<Props, RawBindings, D, C, M, E, VNodeProps & Props>> & Record<string, any>;
26
28
  export declare function mount<PropNames extends string, RawBindings, D, C extends ComputedOptions = {}, M extends Record<string, Function> = {}, E extends EmitsOptions = Record<string, any>, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, EE extends string = string, Props extends Readonly<{
27
29
  [key in PropNames]?: any;
@@ -1,4 +1,4 @@
1
- import { VNodeTypes, ConcreteComponent } from 'vue';
1
+ import { VNodeTypes, ConcreteComponent, DefineComponent } from 'vue';
2
2
  import { Stubs } from './types';
3
3
  export declare type CustomCreateStub = (params: {
4
4
  name: string;
@@ -17,10 +17,6 @@ export declare const registerStub: ({ source, stub, originalStub }: {
17
17
  export declare const getOriginalVNodeTypeFromStub: (type: ConcreteComponent) => VNodeTypes | undefined;
18
18
  export declare const getOriginalStubFromSpecializedStub: (type: ConcreteComponent) => VNodeTypes | undefined;
19
19
  export declare const addToDoNotStubComponents: (type: ConcreteComponent) => WeakSet<ConcreteComponent<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>>;
20
- export declare const createStub: ({ name, type, renderStubDefaultSlot }: StubOptions) => import("vue").DefineComponent<any, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
21
- [key: string]: any;
22
- }>, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, Record<string, any>, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<any>, {} | {
23
- [x: string]: any;
24
- }>;
20
+ export declare const createStub: ({ name, type, renderStubDefaultSlot }: StubOptions) => DefineComponent;
25
21
  export declare function stubComponents(stubs?: Stubs, shallow?: boolean, renderStubDefaultSlot?: boolean): void;
26
22
  export {};
@@ -6,7 +6,7 @@ export interface NameSelector {
6
6
  name: string;
7
7
  length?: never;
8
8
  }
9
- export declare type FindAllComponentsSelector = DefinedComponent | FunctionalComponent | NameSelector | string;
9
+ export declare type FindAllComponentsSelector = DefinedComponent | FunctionalComponent | ComponentOptions | NameSelector | string;
10
10
  export declare type FindComponentSelector = RefSelector | FindAllComponentsSelector;
11
11
  export declare type Slot = VNode | string | {
12
12
  render: Function;
@@ -14,6 +14,7 @@ export declare class VueWrapper<T extends Omit<ComponentPublicInstance, '$emit'
14
14
  protected getRootNodes(): VueNode[];
15
15
  private get parentElement();
16
16
  getCurrentComponent(): import("vue").ComponentInternalInstance;
17
+ exists(): boolean;
17
18
  findAll<K extends keyof HTMLElementTagNameMap>(selector: K): DOMWrapper<HTMLElementTagNameMap[K]>[];
18
19
  findAll<K extends keyof SVGElementTagNameMap>(selector: K): DOMWrapper<SVGElementTagNameMap[K]>[];
19
20
  findAll<T extends Element>(selector: string): DOMWrapper<T>[];
@@ -25,7 +26,7 @@ export declare class VueWrapper<T extends Omit<ComponentPublicInstance, '$emit'
25
26
  };
26
27
  props(selector: string): any;
27
28
  emitted<T = unknown>(): Record<string, T[]>;
28
- emitted<T = unknown>(eventName: string): undefined | T[];
29
+ emitted<T = unknown[]>(eventName: string): undefined | T[];
29
30
  isVisible(): boolean;
30
31
  setData(data: Record<string, unknown>): Promise<void>;
31
32
  setProps(props: Record<string, unknown>): Promise<void>;