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