cypress 10.4.0 → 10.7.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 (43) hide show
  1. package/angular/CHANGELOG.md +86 -0
  2. package/angular/README.md +85 -0
  3. package/angular/dist/index.d.ts +1 -0
  4. package/angular/dist/index.js +265 -0
  5. package/angular/dist/mount.d.ts +112 -0
  6. package/angular/package.json +68 -0
  7. package/lib/tasks/download.js +4 -3
  8. package/mount-utils/CHANGELOG.md +7 -0
  9. package/mount-utils/package.json +5 -1
  10. package/package.json +16 -4
  11. package/react/CHANGELOG.md +20 -0
  12. package/react/dist/createMount.d.ts +7 -6
  13. package/react/dist/cypress-react.cjs.js +653 -140
  14. package/react/dist/cypress-react.esm-bundler.js +640 -127
  15. package/react/dist/mount.d.ts +2 -1
  16. package/react/dist/mountHook.d.ts +1 -0
  17. package/react/dist/types.d.ts +2 -7
  18. package/react/package.json +4 -6
  19. package/react18/CHANGELOG.md +13 -0
  20. package/react18/dist/cypress-react.cjs.js +300 -118
  21. package/react18/dist/cypress-react.esm-bundler.js +286 -104
  22. package/react18/dist/index.d.ts +2 -1
  23. package/react18/package.json +2 -2
  24. package/svelte/CHANGELOG.md +0 -0
  25. package/svelte/README.md +83 -0
  26. package/svelte/dist/cypress-svelte.cjs.js +213 -0
  27. package/svelte/dist/cypress-svelte.esm-bundler.js +209 -0
  28. package/svelte/dist/index.d.ts +1 -0
  29. package/svelte/dist/mount.d.ts +30 -0
  30. package/svelte/package.json +43 -0
  31. package/types/cypress-type-helpers.d.ts +3 -1
  32. package/types/cypress.d.ts +61 -5
  33. package/vue/CHANGELOG.md +14 -0
  34. package/vue/dist/cypress-vue.cjs.js +30 -38
  35. package/vue/dist/cypress-vue.esm-bundler.js +30 -38
  36. package/vue/dist/index.d.ts +1 -0
  37. package/vue/package.json +2 -8
  38. package/vue2/CHANGELOG.md +7 -0
  39. package/vue2/dist/cypress-vue2.cjs.js +53 -84
  40. package/vue2/dist/cypress-vue2.esm-bundler.js +53 -84
  41. package/vue2/dist/index.d.ts +1 -0
  42. package/vue2/package.json +2 -5
  43. package/vue2/dist/cypress-vue2.browser.js +0 -20197
@@ -7,32 +7,6 @@
7
7
 
8
8
  import require$$0$1 from 'vue';
9
9
 
10
- /******************************************************************************
11
- Copyright (c) Microsoft Corporation.
12
-
13
- Permission to use, copy, modify, and/or distribute this software for any
14
- purpose with or without fee is hereby granted.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
17
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
18
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
19
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
20
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
21
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22
- PERFORMANCE OF THIS SOFTWARE.
23
- ***************************************************************************** */
24
-
25
- var __assign = function() {
26
- __assign = Object.assign || function __assign(t) {
27
- for (var s, i = 1, n = arguments.length; i < n; i++) {
28
- s = arguments[i];
29
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
30
- }
31
- return t;
32
- };
33
- return __assign.apply(this, arguments);
34
- };
35
-
36
10
  var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
37
11
 
38
12
  function createCommonjsModule$1(fn) {
@@ -19979,64 +19953,60 @@ function setupHooks(optionalCallback) {
19979
19953
  });
19980
19954
  }
19981
19955
 
19982
- var defaultOptions = [
19956
+ const defaultOptions = [
19983
19957
  'vue',
19984
19958
  'extensions',
19985
19959
  ];
19986
- var DEFAULT_COMP_NAME = 'unknown';
19987
- var registerGlobalComponents = function (Vue, options) {
19988
- var globalComponents = Cypress._.get(options, 'extensions.components');
19960
+ const DEFAULT_COMP_NAME = 'unknown';
19961
+ const registerGlobalComponents = (Vue, options) => {
19962
+ const globalComponents = Cypress._.get(options, 'extensions.components');
19989
19963
  if (Cypress._.isPlainObject(globalComponents)) {
19990
- Cypress._.forEach(globalComponents, function (component, id) {
19964
+ Cypress._.forEach(globalComponents, (component, id) => {
19991
19965
  Vue.component(id, component);
19992
19966
  });
19993
19967
  }
19994
19968
  };
19995
- var installFilters = function (Vue, options) {
19996
- var filters = Cypress._.get(options, 'extensions.filters');
19969
+ const installFilters = (Vue, options) => {
19970
+ const filters = Cypress._.get(options, 'extensions.filters');
19997
19971
  if (Cypress._.isPlainObject(filters)) {
19998
- Object.keys(filters).forEach(function (name) {
19972
+ Object.keys(filters).forEach((name) => {
19999
19973
  Vue.filter(name, filters[name]);
20000
19974
  });
20001
19975
  }
20002
19976
  };
20003
- var installPlugins = function (Vue, options, props) {
20004
- var plugins = Cypress._.get(props, 'plugins') ||
19977
+ const installPlugins = (Vue, options, props) => {
19978
+ const plugins = Cypress._.get(props, 'plugins') ||
20005
19979
  Cypress._.get(options, 'extensions.use') ||
20006
19980
  Cypress._.get(options, 'extensions.plugins') ||
20007
19981
  [];
20008
19982
  // @ts-ignore
20009
- plugins.forEach(function (p) {
20010
- Array.isArray(p) ? Vue.use.apply(Vue, p) : Vue.use(p);
19983
+ plugins.forEach((p) => {
19984
+ Array.isArray(p) ? Vue.use(...p) : Vue.use(p);
20011
19985
  });
20012
19986
  };
20013
- var installMixins = function (Vue, options) {
20014
- var mixins = Cypress._.get(options, 'extensions.mixin') ||
19987
+ const installMixins = (Vue, options) => {
19988
+ const mixins = Cypress._.get(options, 'extensions.mixin') ||
20015
19989
  Cypress._.get(options, 'extensions.mixins');
20016
19990
  if (Cypress._.isArray(mixins)) {
20017
- mixins.forEach(function (mixin) {
19991
+ mixins.forEach((mixin) => {
20018
19992
  Vue.mixin(mixin);
20019
19993
  });
20020
19994
  }
20021
19995
  };
20022
- var hasStore = function (_a) {
20023
- var store = _a.store;
20024
- return Boolean(store && store._vm);
20025
- };
20026
- var forEachValue = function (obj, fn) {
20027
- return Object.keys(obj).forEach(function (key) { return fn(obj[key], key); });
19996
+ const hasStore = ({ store }) => Boolean(store && store._vm);
19997
+ const forEachValue = (obj, fn) => {
19998
+ return Object.keys(obj).forEach((key) => fn(obj[key], key));
20028
19999
  };
20029
- var resetStoreVM = function (Vue, _a) {
20030
- var store = _a.store;
20000
+ const resetStoreVM = (Vue, { store }) => {
20031
20001
  // bind store public getters
20032
20002
  store.getters = {};
20033
- var wrappedGetters = store._wrappedGetters;
20034
- var computed = {};
20035
- forEachValue(wrappedGetters, function (fn, key) {
20003
+ const wrappedGetters = store._wrappedGetters;
20004
+ const computed = {};
20005
+ forEachValue(wrappedGetters, (fn, key) => {
20036
20006
  // use computed to leverage its lazy-caching mechanism
20037
- computed[key] = function () { return fn(store); };
20007
+ computed[key] = () => fn(store);
20038
20008
  Object.defineProperty(store.getters, key, {
20039
- get: function () { return store._vm[key]; },
20009
+ get: () => store._vm[key],
20040
20010
  enumerable: true, // for local getters
20041
20011
  });
20042
20012
  });
@@ -20045,7 +20015,7 @@ var resetStoreVM = function (Vue, _a) {
20045
20015
  data: {
20046
20016
  $$state: store._vm._data.$$state,
20047
20017
  },
20048
- computed: computed,
20018
+ computed,
20049
20019
  });
20050
20020
  return store;
20051
20021
  };
@@ -20056,19 +20026,19 @@ var resetStoreVM = function (Vue, _a) {
20056
20026
  * @see https://github.com/cypress-io/cypress/issues/7910
20057
20027
  */
20058
20028
  function failTestOnVueError(err, vm, info) {
20059
- console.error("Vue error");
20029
+ console.error(`Vue error`);
20060
20030
  console.error(err);
20061
20031
  console.error('component:', vm);
20062
20032
  console.error('info:', info);
20063
20033
  window.top.onerror(err);
20064
20034
  }
20065
20035
  function registerAutoDestroy($destroy) {
20066
- Cypress.on('test:before:run', function () {
20036
+ Cypress.on('test:before:run', () => {
20067
20037
  $destroy();
20068
20038
  });
20069
20039
  }
20070
20040
  enableAutoDestroy_1(registerAutoDestroy);
20071
- var injectStyles = function (options) {
20041
+ const injectStyles = (options) => {
20072
20042
  return injectStylesBeforeElement(options, document, getContainerEl());
20073
20043
  };
20074
20044
  /**
@@ -20082,10 +20052,10 @@ function getComponentDisplayName(componentOptions) {
20082
20052
  return componentOptions.name;
20083
20053
  }
20084
20054
  if (componentOptions.__file) {
20085
- var filepathSplit = componentOptions.__file.split('/');
20086
- var fileName = (_a = filepathSplit[filepathSplit.length - 1]) !== null && _a !== void 0 ? _a : DEFAULT_COMP_NAME;
20055
+ const filepathSplit = componentOptions.__file.split('/');
20056
+ const fileName = (_a = filepathSplit[filepathSplit.length - 1]) !== null && _a !== void 0 ? _a : DEFAULT_COMP_NAME;
20087
20057
  // remove the extension .js, .ts or .vue from the filename to get the name of the component
20088
- var baseFileName = fileName.replace(/\.(js|ts|vue)?$/, '');
20058
+ const baseFileName = fileName.replace(/\.(js|ts|vue)?$/, '');
20089
20059
  // if the filename is index, then we can use the direct parent foldername, else use the name itself
20090
20060
  return (baseFileName === 'index' ? filepathSplit[filepathSplit.length - 2] : baseFileName);
20091
20061
  }
@@ -20104,35 +20074,34 @@ function getComponentDisplayName(componentOptions) {
20104
20074
  * cy.get('#greeting').should('be.visible')
20105
20075
  * })
20106
20076
  */
20107
- var mount = function (component, optionsOrProps) {
20108
- if (optionsOrProps === void 0) { optionsOrProps = {}; }
20109
- var options = Cypress._.pick(optionsOrProps, defaultOptions);
20110
- var props = Cypress._.omit(optionsOrProps, defaultOptions);
20111
- var componentName = getComponentDisplayName(component);
20112
- var message = "<" + componentName + " ... />";
20077
+ const mount = (component, optionsOrProps = {}) => {
20078
+ const options = Cypress._.pick(optionsOrProps, defaultOptions);
20079
+ const props = Cypress._.omit(optionsOrProps, defaultOptions);
20080
+ const componentName = getComponentDisplayName(component);
20081
+ const message = `<${componentName} ... />`;
20113
20082
  return cy
20114
20083
  .window({
20115
20084
  log: false,
20116
20085
  })
20117
- .then(function () {
20118
- var style = optionsOrProps.style, stylesheets = optionsOrProps.stylesheets, stylesheet = optionsOrProps.stylesheet, styles = optionsOrProps.styles, cssFiles = optionsOrProps.cssFiles, cssFile = optionsOrProps.cssFile;
20086
+ .then(() => {
20087
+ const { style, stylesheets, stylesheet, styles, cssFiles, cssFile } = optionsOrProps;
20119
20088
  injectStyles({
20120
- style: style,
20121
- stylesheets: stylesheets,
20122
- stylesheet: stylesheet,
20123
- styles: styles,
20124
- cssFiles: cssFiles,
20125
- cssFile: cssFile,
20089
+ style,
20090
+ stylesheets,
20091
+ stylesheet,
20092
+ styles,
20093
+ cssFiles,
20094
+ cssFile,
20126
20095
  });
20127
20096
  })
20128
- .then(function (win) {
20097
+ .then((win) => {
20129
20098
  if (optionsOrProps.log !== false) {
20130
20099
  Cypress.log({
20131
20100
  name: 'mount',
20132
20101
  message: [message],
20133
20102
  }).snapshot('mounted').end();
20134
20103
  }
20135
- var localVue = createLocalVue_1();
20104
+ const localVue = createLocalVue_1();
20136
20105
  // @ts-ignore
20137
20106
  win.Vue = localVue;
20138
20107
  localVue.config.errorHandler = failTestOnVueError;
@@ -20147,9 +20116,9 @@ var mount = function (component, optionsOrProps) {
20147
20116
  component.store = resetStoreVM(localVue, component);
20148
20117
  }
20149
20118
  // @ts-ignore
20150
- var document = cy.state('document');
20151
- var el = getContainerEl();
20152
- var componentNode = document.createElement('div');
20119
+ const document = cy.state('document');
20120
+ let el = getContainerEl();
20121
+ const componentNode = document.createElement('div');
20153
20122
  el.append(componentNode);
20154
20123
  // setup Vue instance
20155
20124
  installFilters(localVue, options);
@@ -20157,8 +20126,8 @@ var mount = function (component, optionsOrProps) {
20157
20126
  installPlugins(localVue, options, props);
20158
20127
  registerGlobalComponents(localVue, options);
20159
20128
  props.attachTo = componentNode;
20160
- var wrapper = localVue.extend(component);
20161
- var VTUWrapper = mount_1(wrapper, __assign({ localVue: localVue }, props));
20129
+ const wrapper = localVue.extend(component);
20130
+ const VTUWrapper = mount_1(wrapper, Object.assign({ localVue }, props));
20162
20131
  Cypress.vue = VTUWrapper.vm;
20163
20132
  Cypress.vueWrapper = VTUWrapper;
20164
20133
  });
@@ -20169,8 +20138,8 @@ var mount = function (component, optionsOrProps) {
20169
20138
  * import {mountCallback} from '@cypress/vue2'
20170
20139
  * beforeEach(mountVue(component, options))
20171
20140
  */
20172
- var mountCallback = function (component, options) {
20173
- return function () { return mount(component, options); };
20141
+ const mountCallback = (component, options) => {
20142
+ return () => mount(component, options);
20174
20143
  };
20175
20144
  // Side effects from "import { mount } from '@cypress/<my-framework>'" are annoying, we should avoid doing this
20176
20145
  // by creating an explicit function/import that the user can register in their 'component.js' support file,
@@ -1,4 +1,5 @@
1
1
  /// <reference types="cypress" />
2
+ /// <reference types="cypress" />
2
3
  import Vue from 'vue';
3
4
  import { VueTestUtilsConfigOptions, Wrapper } from '@vue/test-utils';
4
5
  import { StyleOptions } from '@cypress/mount-utils';
package/vue2/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "main": "dist/cypress-vue2.cjs.js",
6
6
  "scripts": {
7
7
  "typecheck": "tsc --noEmit",
8
- "build": "rimraf dist && yarn rollup -c rollup.config.js",
8
+ "build": "rimraf dist && yarn rollup -c rollup.config.mjs",
9
9
  "postbuild": "node ../../scripts/sync-exported-npm-with-cli.js",
10
10
  "build-prod": "yarn build",
11
11
  "test": "echo \"Tests for @cypress/vue2 are run from system-tests\"",
@@ -17,13 +17,10 @@
17
17
  },
18
18
  "devDependencies": {
19
19
  "@cypress/mount-utils": "0.0.0-development",
20
- "@rollup/plugin-commonjs": "^17.1.0",
21
20
  "@rollup/plugin-json": "^4.1.0",
22
- "@rollup/plugin-node-resolve": "^11.1.1",
23
21
  "@rollup/plugin-replace": "^2.3.1",
24
- "rollup-plugin-typescript2": "^0.29.0",
25
22
  "tslib": "^2.1.0",
26
- "typescript": "^4.2.3",
23
+ "typescript": "^4.7.4",
27
24
  "vue": "2.6.12"
28
25
  },
29
26
  "peerDependencies": {