diff --git a/cypress/support/component.js b/cypress/support/component.js index dc0d7fd99..b15bf4cf6 100644 --- a/cypress/support/component.js +++ b/cypress/support/component.js @@ -1,7 +1,6 @@ import { mount } from 'cypress/vue2' import store from '../../src/store/store.js' import data from '../../src/store/data.js' -import Vuex from 'vuex' import { translate as t, translatePlural as n } from '@nextcloud/l10n' const tables = { @@ -26,20 +25,23 @@ const tables = { }, } -Cypress.Commands.add('mount', (component, options = {}) => { - options.extensions = options.extensions || {} - - options.extensions.mixins = options.extensions.mixins || [] - options.extensions.mixins.push({ - methods: { t, n }, - store: { - ...store, - ...data, - }, - }) +const defaultOptions = { + extensions: { + mixins: [ + { methods: {t, n } }, + { store: { ...store, ...data } } + ], + plugins: [], + components: {}, + }, +} - options.extensions.plugins = options.extensions.plugins || [] - options.extensions.plugins.push(Vuex) +Cypress.Commands.add('mount', (component, options) => { + // Use default options and mix in the given options + options = { + ...defaultOptions, + ...options, + } return mount(component, options) })