diff --git a/ee/spec/frontend/audit_events/components/audit_events_stream_spec.js b/ee/spec/frontend/audit_events/components/audit_events_stream_spec.js index cb6e92247d765a70b51ea3fe237b7794e6872ad6..7bdf7ac44271a7e174e505fa504f3b456ec9626c 100644 --- a/ee/spec/frontend/audit_events/components/audit_events_stream_spec.js +++ b/ee/spec/frontend/audit_events/components/audit_events_stream_spec.js @@ -1,6 +1,6 @@ +import Vue from 'vue'; import VueApollo from 'vue-apollo'; import { GlButton, GlLoadingIcon } from '@gitlab/ui'; -import { createLocalVue } from '@vue/test-utils'; import { createAlert } from '~/flash'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import createMockApollo from 'helpers/mock_apollo_helper'; @@ -18,8 +18,7 @@ import { } from '../mock_data'; jest.mock('~/flash'); -const localVue = createLocalVue(); -localVue.use(VueApollo); +Vue.use(VueApollo); describe('AuditEventsStream', () => { let wrapper; @@ -36,7 +35,6 @@ describe('AuditEventsStream', () => { streamsIconSvgPath: mockSvgPath, }, apolloProvider: mockApollo, - localVue, }); }; diff --git a/ee/spec/frontend/audit_events/components/stream/stream_destination_editor_spec.js b/ee/spec/frontend/audit_events/components/stream/stream_destination_editor_spec.js index 5797d014816f091aa7134ce8aa76019e8d561748..4a3c25216ea02db88c764cedbc4c77e6d2e5d641 100644 --- a/ee/spec/frontend/audit_events/components/stream/stream_destination_editor_spec.js +++ b/ee/spec/frontend/audit_events/components/stream/stream_destination_editor_spec.js @@ -1,5 +1,5 @@ +import Vue from 'vue'; import VueApollo from 'vue-apollo'; -import { createLocalVue } from '@vue/test-utils'; import { GlButton, GlFormCheckbox, GlForm, GlTableLite } from '@gitlab/ui'; import * as Sentry from '@sentry/browser'; import { sprintf } from '~/locale'; @@ -24,8 +24,7 @@ import { mockExternalDestinationHeader, } from '../../mock_data'; -const localVue = createLocalVue(); -localVue.use(VueApollo); +Vue.use(VueApollo); describe('StreamDestinationEditor', () => { let wrapper; @@ -53,7 +52,6 @@ describe('StreamDestinationEditor', () => { }, propsData, apolloProvider: mockApollo, - localVue, }); }; diff --git a/ee/spec/frontend/audit_events/components/stream/stream_item_spec.js b/ee/spec/frontend/audit_events/components/stream/stream_item_spec.js index e0f7e7a1eb421915143b3c38541216d1503a2316..12b9454328fb9c2c566e063c1cba6fd285cac052 100644 --- a/ee/spec/frontend/audit_events/components/stream/stream_item_spec.js +++ b/ee/spec/frontend/audit_events/components/stream/stream_item_spec.js @@ -1,5 +1,5 @@ +import Vue from 'vue'; import VueApollo from 'vue-apollo'; -import { createLocalVue } from '@vue/test-utils'; import { GlButton } from '@gitlab/ui'; import { createAlert } from '~/flash'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; @@ -12,8 +12,7 @@ import StreamDestinationEditor from 'ee/audit_events/components/stream/stream_de import { destinationDeleteMutationPopulator, mockExternalDestinations } from '../../mock_data'; jest.mock('~/flash'); -const localVue = createLocalVue(); -localVue.use(VueApollo); +Vue.use(VueApollo); describe('StreamItem', () => { let wrapper; @@ -34,7 +33,6 @@ describe('StreamItem', () => { stubs: { GlButton, }, - localVue, }); }; diff --git a/ee/spec/frontend/registrations/company/new/components/company_form_spec.js b/ee/spec/frontend/registrations/company/new/components/company_form_spec.js index dbd447f0f229ab5df987825b680b32d416320168..4de75f72374e62a7558501b64b81d856ef0167a3 100644 --- a/ee/spec/frontend/registrations/company/new/components/company_form_spec.js +++ b/ee/spec/frontend/registrations/company/new/components/company_form_spec.js @@ -1,12 +1,9 @@ import { GlButton, GlForm, GlFormText, GlToggle } from '@gitlab/ui'; -import { createLocalVue } from '@vue/test-utils'; import { nextTick } from 'vue'; import RegistrationForm from 'ee/registrations/components/company_form.vue'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { TRIAL_FORM_SUBMIT_TEXT } from 'ee/trials/constants'; -const localVue = createLocalVue(); - const SUBMIT_PATH = '_submit_path_'; describe('RegistrationForm', () => { @@ -14,7 +11,6 @@ describe('RegistrationForm', () => { const createComponent = ({ mountFunction = shallowMountExtended, propsData } = {}) => { return mountFunction(RegistrationForm, { - localVue, provide: { submitPath: SUBMIT_PATH, }, diff --git a/ee/spec/frontend/trials/components/trial_create_lead_form_spec.js b/ee/spec/frontend/trials/components/trial_create_lead_form_spec.js index 2cdcefd08445912803ee3861f79cb5d223d2f8dd..7315d2cfc845d575b3bba7679776d9e66dccdaf6 100644 --- a/ee/spec/frontend/trials/components/trial_create_lead_form_spec.js +++ b/ee/spec/frontend/trials/components/trial_create_lead_form_spec.js @@ -1,5 +1,5 @@ import { GlButton, GlForm } from '@gitlab/ui'; -import { createLocalVue } from '@vue/test-utils'; +import Vue from 'vue'; import VueApollo from 'vue-apollo'; import { mountExtended, shallowMountExtended } from 'helpers/vue_test_utils_helper'; import TrialCreateLeadForm from 'ee/trials/components/trial_create_lead_form.vue'; @@ -11,15 +11,13 @@ jest.mock('~/google_tag_manager', () => ({ trackSaasTrialSubmit: jest.fn(), })); -const localVue = createLocalVue(); -localVue.use(VueApollo); +Vue.use(VueApollo); describe('TrialCreateLeadForm', () => { let wrapper; const createComponent = ({ mountFunction = shallowMountExtended } = {}) => { return mountFunction(TrialCreateLeadForm, { - localVue, provide: { submitPath: SUBMIT_PATH, user: FORM_DATA, diff --git a/spec/frontend/pipeline_editor/components/pipeline_editor_tabs_spec.js b/spec/frontend/pipeline_editor/components/pipeline_editor_tabs_spec.js index 87a7f07f7d445edb5b0afac335ef807216c887bb..d990d5ad22b69c2e8cb2ca6a90a981d8ae367d38 100644 --- a/spec/frontend/pipeline_editor/components/pipeline_editor_tabs_spec.js +++ b/spec/frontend/pipeline_editor/components/pipeline_editor_tabs_spec.js @@ -1,5 +1,5 @@ import { GlAlert, GlBadge, GlLoadingIcon, GlTabs } from '@gitlab/ui'; -import { createLocalVue, mount, shallowMount } from '@vue/test-utils'; +import { mount, shallowMount } from '@vue/test-utils'; import VueApollo from 'vue-apollo'; import Vue, { nextTick } from 'vue'; import createMockApollo from 'helpers/mock_apollo_helper'; @@ -30,8 +30,7 @@ import { mockLintResponseWithoutMerged, } from '../mock_data'; -const localVue = createLocalVue(); -localVue.use(VueApollo); +Vue.use(VueApollo); Vue.config.ignoredElements = ['gl-emoji']; @@ -88,7 +87,6 @@ describe('Pipeline editor tabs component', () => { provide, mountFn, options: { - localVue, apolloProvider: mockApollo, }, }); diff --git a/spec/frontend/runner/components/registration/registration_token_spec.js b/spec/frontend/runner/components/registration/registration_token_spec.js index ed1a698d36f1b6d3b4f69e0c1fd62c8d3c3999dc..19344a68f79371d319d7e7f44205dd56eafbf971 100644 --- a/spec/frontend/runner/components/registration/registration_token_spec.js +++ b/spec/frontend/runner/components/registration/registration_token_spec.js @@ -1,5 +1,5 @@ import { GlToast } from '@gitlab/ui'; -import { createLocalVue } from '@vue/test-utils'; +import Vue from 'vue'; import { mountExtended, shallowMountExtended } from 'helpers/vue_test_utils_helper'; import RegistrationToken from '~/runner/components/registration/registration_token.vue'; import InputCopyToggleVisibility from '~/vue_shared/components/form/input_copy_toggle_visibility.vue'; @@ -11,28 +11,17 @@ describe('RegistrationToken', () => { let wrapper; let showToast; - const findInputCopyToggleVisibility = () => wrapper.findComponent(InputCopyToggleVisibility); - - const vueWithGlToast = () => { - const localVue = createLocalVue(); - localVue.use(GlToast); - return localVue; - }; + Vue.use(GlToast); - const createComponent = ({ - props = {}, - withGlToast = true, - mountFn = shallowMountExtended, - } = {}) => { - const localVue = withGlToast ? vueWithGlToast() : undefined; + const findInputCopyToggleVisibility = () => wrapper.findComponent(InputCopyToggleVisibility); + const createComponent = ({ props = {}, mountFn = shallowMountExtended } = {}) => { wrapper = mountFn(RegistrationToken, { propsData: { value: mockToken, inputId: 'token-value', ...props, }, - localVue, }); showToast = wrapper.vm.$toast ? jest.spyOn(wrapper.vm.$toast, 'show') : null; @@ -69,13 +58,5 @@ describe('RegistrationToken', () => { expect(showToast).toHaveBeenCalledTimes(1); expect(showToast).toHaveBeenCalledWith('Registration token copied!'); }); - - it('does not fail when toast is not defined', () => { - createComponent({ withGlToast: false }); - findInputCopyToggleVisibility().vm.$emit('copy'); - - // This block also tests for unhandled errors - expect(showToast).toBeNull(); - }); }); }); diff --git a/spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js b/spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js index 46d90ddc83ccb6bf1443c08c66c4794aeaa49eea..188582d2e05bb8c501eb481aaf69e9aa85387189 100644 --- a/spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js +++ b/spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js @@ -1,5 +1,5 @@ -import { createLocalVue, shallowMount } from '@vue/test-utils'; -import { nextTick } from 'vue'; +import { shallowMount } from '@vue/test-utils'; +import Vue, { nextTick } from 'vue'; import { GlSprintf } from '@gitlab/ui'; import VueApollo from 'vue-apollo'; import produce from 'immer'; @@ -71,8 +71,8 @@ const createTestService = () => ({ merge: jest.fn(), poll: jest.fn().mockResolvedValue(), }); -const localVue = createLocalVue(); -localVue.use(VueApollo); + +Vue.use(VueApollo); let wrapper; let readyToMergeResponseSpy; @@ -93,7 +93,6 @@ const createComponent = ( restructuredMrWidget = false, ) => { wrapper = shallowMount(ReadyToMerge, { - localVue, propsData: { mr: createTestMr(customConfig), service: createTestService(), diff --git a/spec/frontend/work_items_hierarchy/components/app_spec.js b/spec/frontend/work_items_hierarchy/components/app_spec.js index 092e9c90553f5780c5b6000d55bd6a8039b506f5..1426fbfab80b7197278010e0d3d09375e5cb74a6 100644 --- a/spec/frontend/work_items_hierarchy/components/app_spec.js +++ b/spec/frontend/work_items_hierarchy/components/app_spec.js @@ -1,19 +1,17 @@ -import { nextTick } from 'vue'; -import { createLocalVue, mount } from '@vue/test-utils'; +import Vue, { nextTick } from 'vue'; +import { mount } from '@vue/test-utils'; import VueApollo from 'vue-apollo'; import { GlBanner } from '@gitlab/ui'; import App from '~/work_items_hierarchy/components/app.vue'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; -const localVue = createLocalVue(); -localVue.use(VueApollo); +Vue.use(VueApollo); describe('WorkItemsHierarchy App', () => { let wrapper; const createComponent = (props = {}, data = {}) => { wrapper = extendedWrapper( mount(App, { - localVue, provide: { illustrationPath: '/foo.svg', licensePlan: 'free', diff --git a/spec/frontend/work_items_hierarchy/components/hierarchy_spec.js b/spec/frontend/work_items_hierarchy/components/hierarchy_spec.js index 74774e38d6b36d194ca7b068b2ad6246f58562a3..67420e7fc2a01f8cb4fe8cd5208b6e8a18f88fa9 100644 --- a/spec/frontend/work_items_hierarchy/components/hierarchy_spec.js +++ b/spec/frontend/work_items_hierarchy/components/hierarchy_spec.js @@ -1,4 +1,5 @@ -import { createLocalVue, mount } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import VueApollo from 'vue-apollo'; import { GlBadge } from '@gitlab/ui'; import Hierarchy from '~/work_items_hierarchy/components/hierarchy.vue'; @@ -6,8 +7,7 @@ import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import RESPONSE from '~/work_items_hierarchy/static_response'; import { workItemTypes } from '~/work_items_hierarchy/constants'; -const localVue = createLocalVue(); -localVue.use(VueApollo); +Vue.use(VueApollo); describe('WorkItemsHierarchy Hierarchy', () => { let wrapper; @@ -32,7 +32,6 @@ describe('WorkItemsHierarchy Hierarchy', () => { const createComponent = (props = {}) => { wrapper = extendedWrapper( mount(Hierarchy, { - localVue, propsData: { workItemTypes: props.workItemTypes, ...props,