diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-21 18:13:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-01-21 18:13:54 +0300 |
commit | 48fc1ad8991a96ef2eaa927bb6df3bfab2c78e46 (patch) | |
tree | 12d1587e82af71bb32db890fe865e18269d5edd7 /spec | |
parent | cb6f08be88608936fbeafa535cf725e1eaa3ffeb (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec')
106 files changed, 422 insertions, 437 deletions
diff --git a/spec/features/admin/admin_runners_spec.rb b/spec/features/admin/admin_runners_spec.rb index 37aa1433994..76d6fded531 100644 --- a/spec/features/admin/admin_runners_spec.rb +++ b/spec/features/admin/admin_runners_spec.rb @@ -254,6 +254,18 @@ RSpec.describe "Admin Runners" do expect(page).not_to have_content 'runner-group' end + it 'show the same counts after selecting another tab' do + visit admin_runners_path + + page.within('[data-testid="runner-type-tabs"]') do + click_on('Project') + + expect(page).to have_link('All 2') + expect(page).to have_link('Group 1') + expect(page).to have_link('Project 1') + end + end + it 'shows no runner when type does not match' do visit admin_runners_path diff --git a/spec/frontend/add_context_commits_modal/components/add_context_commits_modal_spec.js b/spec/frontend/add_context_commits_modal/components/add_context_commits_modal_spec.js index e7a20ae114c..1918d5c5611 100644 --- a/spec/frontend/add_context_commits_modal/components/add_context_commits_modal_spec.js +++ b/spec/frontend/add_context_commits_modal/components/add_context_commits_modal_spec.js @@ -1,5 +1,6 @@ import { GlModal, GlSearchBoxByType } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import getDiffWithCommit from 'test_fixtures/merge_request_diffs/with_commit.json'; import AddReviewItemsModal from '~/add_context_commits_modal/components/add_context_commits_modal_wrapper.vue'; @@ -8,8 +9,7 @@ import * as actions from '~/add_context_commits_modal/store/actions'; import mutations from '~/add_context_commits_modal/store/mutations'; import defaultState from '~/add_context_commits_modal/store/state'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('AddContextCommitsModal', () => { let wrapper; @@ -36,7 +36,6 @@ describe('AddContextCommitsModal', () => { }); wrapper = shallowMount(AddReviewItemsModal, { - localVue, store, propsData: { contextCommitsPath: '', diff --git a/spec/frontend/badges/components/badge_settings_spec.js b/spec/frontend/badges/components/badge_settings_spec.js index 0c29379763e..8ac5d2c72d9 100644 --- a/spec/frontend/badges/components/badge_settings_spec.js +++ b/spec/frontend/badges/components/badge_settings_spec.js @@ -1,5 +1,6 @@ import { GlModal } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import BadgeList from '~/badges/components/badge_list.vue'; import BadgeListRow from '~/badges/components/badge_list_row.vue'; @@ -7,8 +8,7 @@ import BadgeSettings from '~/badges/components/badge_settings.vue'; import store from '~/badges/store'; import { createDummyBadge } from '../dummy_badge'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('BadgeSettings component', () => { let wrapper; @@ -21,7 +21,6 @@ describe('BadgeSettings component', () => { wrapper = shallowMount(BadgeSettings, { store, - localVue, stubs: { 'badge-list': BadgeList, 'badge-list-row': BadgeListRow, diff --git a/spec/frontend/batch_comments/components/diff_file_drafts_spec.js b/spec/frontend/batch_comments/components/diff_file_drafts_spec.js index dcb68b1804f..8805f6bf204 100644 --- a/spec/frontend/batch_comments/components/diff_file_drafts_spec.js +++ b/spec/frontend/batch_comments/components/diff_file_drafts_spec.js @@ -1,11 +1,10 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import DiffFileDrafts from '~/batch_comments/components/diff_file_drafts.vue'; import DraftNote from '~/batch_comments/components/draft_note.vue'; -const localVue = createLocalVue(); - -localVue.use(Vuex); +Vue.use(Vuex); describe('Batch comments diff file drafts component', () => { let vm; @@ -22,9 +21,8 @@ describe('Batch comments diff file drafts component', () => { }, }); - vm = shallowMount(localVue.extend(DiffFileDrafts), { + vm = shallowMount(DiffFileDrafts, { store, - localVue, propsData: { fileHash: 'filehash' }, }); } diff --git a/spec/frontend/batch_comments/components/draft_note_spec.js b/spec/frontend/batch_comments/components/draft_note_spec.js index 5d22823e974..9c0d59c4443 100644 --- a/spec/frontend/batch_comments/components/draft_note_spec.js +++ b/spec/frontend/batch_comments/components/draft_note_spec.js @@ -1,5 +1,5 @@ import { getByRole } from '@testing-library/dom'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; import { stubComponent } from 'helpers/stub_component'; import DraftNote from '~/batch_comments/components/draft_note.vue'; import { createStore } from '~/batch_comments/stores'; @@ -7,8 +7,6 @@ import NoteableNote from '~/notes/components/noteable_note.vue'; import '~/behaviors/markdown/render_gfm'; import { createDraft } from '../mock_data'; -const localVue = createLocalVue(); - const NoteableNoteStub = stubComponent(NoteableNote, { template: ` <div> @@ -31,10 +29,9 @@ describe('Batch comments draft note component', () => { const getList = () => getByRole(wrapper.element, 'list'); const createComponent = (propsData = { draft }) => { - wrapper = shallowMount(localVue.extend(DraftNote), { + wrapper = shallowMount(DraftNote, { store, propsData, - localVue, stubs: { NoteableNote: NoteableNoteStub, }, diff --git a/spec/frontend/batch_comments/components/publish_dropdown_spec.js b/spec/frontend/batch_comments/components/publish_dropdown_spec.js index bd8091c20e0..a3168931f1f 100644 --- a/spec/frontend/batch_comments/components/publish_dropdown_spec.js +++ b/spec/frontend/batch_comments/components/publish_dropdown_spec.js @@ -1,13 +1,13 @@ import { GlDropdown, GlDropdownItem } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import PreviewDropdown from '~/batch_comments/components/preview_dropdown.vue'; import { createStore } from '~/mr_notes/stores'; import '~/behaviors/markdown/render_gfm'; import { createDraft } from '../mock_data'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('Batch comments publish dropdown component', () => { let wrapper; diff --git a/spec/frontend/boards/components/board_new_issue_spec.js b/spec/frontend/boards/components/board_new_issue_spec.js index 57ccebf3676..12bee842c85 100644 --- a/spec/frontend/boards/components/board_new_issue_spec.js +++ b/spec/frontend/boards/components/board_new_issue_spec.js @@ -1,4 +1,5 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import BoardNewIssue from '~/boards/components/board_new_issue.vue'; import BoardNewItem from '~/boards/components/board_new_item.vue'; @@ -7,9 +8,7 @@ import eventHub from '~/boards/eventhub'; import { mockList, mockGroupProjects } from '../mock_data'; -const localVue = createLocalVue(); - -localVue.use(Vuex); +Vue.use(Vuex); const addListNewIssuesSpy = jest.fn().mockResolvedValue(); const mockActions = { addListNewIssue: addListNewIssuesSpy }; @@ -20,7 +19,6 @@ const createComponent = ({ getters = { isGroupBoard: () => true, isProjectBoard: () => false }, } = {}) => shallowMount(BoardNewIssue, { - localVue, store: new Vuex.Store({ state, actions, diff --git a/spec/frontend/ci_variable_list/components/ci_environments_dropdown_spec.js b/spec/frontend/ci_variable_list/components/ci_environments_dropdown_spec.js index 5c5ea102f12..f4a0eef1129 100644 --- a/spec/frontend/ci_variable_list/components/ci_environments_dropdown_spec.js +++ b/spec/frontend/ci_variable_list/components/ci_environments_dropdown_spec.js @@ -1,10 +1,10 @@ import { GlDropdown, GlDropdownItem, GlIcon } from '@gitlab/ui'; -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import CiEnvironmentsDropdown from '~/ci_variable_list/components/ci_environments_dropdown.vue'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('Ci environments dropdown', () => { let wrapper; @@ -22,7 +22,6 @@ describe('Ci environments dropdown', () => { wrapper = mount(CiEnvironmentsDropdown, { store, - localVue, propsData: { value: term, }, diff --git a/spec/frontend/ci_variable_list/components/ci_variable_modal_spec.js b/spec/frontend/ci_variable_list/components/ci_variable_modal_spec.js index 7c4ff67feb3..085ab1c0c30 100644 --- a/spec/frontend/ci_variable_list/components/ci_variable_modal_spec.js +++ b/spec/frontend/ci_variable_list/components/ci_variable_modal_spec.js @@ -1,5 +1,6 @@ import { GlButton, GlFormInput } from '@gitlab/ui'; -import { createLocalVue, shallowMount, mount } from '@vue/test-utils'; +import { shallowMount, mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import { mockTracking } from 'helpers/tracking_helper'; import CiEnvironmentsDropdown from '~/ci_variable_list/components/ci_environments_dropdown.vue'; @@ -9,8 +10,7 @@ import createStore from '~/ci_variable_list/store'; import mockData from '../services/mock_data'; import ModalStub from '../stubs'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('Ci variable modal', () => { let wrapper; @@ -26,7 +26,6 @@ describe('Ci variable modal', () => { stubs: { GlModal: ModalStub, }, - localVue, store, ...options, }); diff --git a/spec/frontend/ci_variable_list/components/ci_variable_settings_spec.js b/spec/frontend/ci_variable_list/components/ci_variable_settings_spec.js index 03f90f72d87..13e417940a8 100644 --- a/spec/frontend/ci_variable_list/components/ci_variable_settings_spec.js +++ b/spec/frontend/ci_variable_list/components/ci_variable_settings_spec.js @@ -1,10 +1,10 @@ -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import CiVariableSettings from '~/ci_variable_list/components/ci_variable_settings.vue'; import createStore from '~/ci_variable_list/store'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('Ci variable table', () => { let wrapper; @@ -16,7 +16,6 @@ describe('Ci variable table', () => { store.state.isGroup = groupState; jest.spyOn(store, 'dispatch').mockImplementation(); wrapper = shallowMount(CiVariableSettings, { - localVue, store, }); }; diff --git a/spec/frontend/ci_variable_list/components/ci_variable_table_spec.js b/spec/frontend/ci_variable_list/components/ci_variable_table_spec.js index 8367c3f6bb8..2469569b436 100644 --- a/spec/frontend/ci_variable_list/components/ci_variable_table_spec.js +++ b/spec/frontend/ci_variable_list/components/ci_variable_table_spec.js @@ -1,11 +1,11 @@ -import { createLocalVue, mount } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import CiVariableTable from '~/ci_variable_list/components/ci_variable_table.vue'; import createStore from '~/ci_variable_list/store'; import mockData from '../services/mock_data'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('Ci variable table', () => { let wrapper; @@ -16,7 +16,6 @@ describe('Ci variable table', () => { jest.spyOn(store, 'dispatch').mockImplementation(); wrapper = mount(CiVariableTable, { attachTo: document.body, - localVue, store, }); }; diff --git a/spec/frontend/clusters/forms/components/integration_form_spec.js b/spec/frontend/clusters/forms/components/integration_form_spec.js index d041cd1e164..a9fb5c205fd 100644 --- a/spec/frontend/clusters/forms/components/integration_form_spec.js +++ b/spec/frontend/clusters/forms/components/integration_form_spec.js @@ -1,11 +1,11 @@ import { GlToggle, GlButton } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import IntegrationForm from '~/clusters/forms/components/integration_form.vue'; import { createStore } from '~/clusters/forms/stores/index'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('ClusterIntegrationForm', () => { let wrapper; @@ -19,7 +19,6 @@ describe('ClusterIntegrationForm', () => { const createWrapper = (storeValues = defaultStoreValues) => { wrapper = shallowMount(IntegrationForm, { - localVue, store: createStore(storeValues), provide: { autoDevopsHelpPath: 'topics/autodevops/index', diff --git a/spec/frontend/clusters_list/components/clusters_view_all_spec.js b/spec/frontend/clusters_list/components/clusters_view_all_spec.js index 6ef56beddee..81084443889 100644 --- a/spec/frontend/clusters_list/components/clusters_view_all_spec.js +++ b/spec/frontend/clusters_list/components/clusters_view_all_spec.js @@ -1,5 +1,5 @@ import { GlCard, GlLoadingIcon, GlButton, GlSprintf, GlBadge } from '@gitlab/ui'; -import { createLocalVue } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import ClustersViewAll from '~/clusters_list/components/clusters_view_all.vue'; @@ -16,8 +16,7 @@ import { } from '~/clusters_list/constants'; import { sprintf } from '~/locale'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); const addClusterPath = '/path/to/add/cluster'; const defaultBranchName = 'default-branch'; @@ -59,7 +58,6 @@ describe('ClustersViewAllComponent', () => { const createWrapper = ({ initialState }) => { wrapper = shallowMountExtended(ClustersViewAll, { - localVue, store: createStore(initialState), propsData, provide: provideData, diff --git a/spec/frontend/code_navigation/components/app_spec.js b/spec/frontend/code_navigation/components/app_spec.js index 798f3bc0ee2..9306c15e676 100644 --- a/spec/frontend/code_navigation/components/app_spec.js +++ b/spec/frontend/code_navigation/components/app_spec.js @@ -1,15 +1,15 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import App from '~/code_navigation/components/app.vue'; import Popover from '~/code_navigation/components/popover.vue'; import createState from '~/code_navigation/store/state'; -const localVue = createLocalVue(); const fetchData = jest.fn(); const showDefinition = jest.fn(); let wrapper; -localVue.use(Vuex); +Vue.use(Vuex); function factory(initialState = {}) { const store = new Vuex.Store({ @@ -24,7 +24,7 @@ function factory(initialState = {}) { }, }); - wrapper = shallowMount(App, { store, localVue }); + wrapper = shallowMount(App, { store }); } describe('Code navigation app component', () => { diff --git a/spec/frontend/create_cluster/eks_cluster/components/create_eks_cluster_spec.js b/spec/frontend/create_cluster/eks_cluster/components/create_eks_cluster_spec.js index 95810e882a1..c8020cf8308 100644 --- a/spec/frontend/create_cluster/eks_cluster/components/create_eks_cluster_spec.js +++ b/spec/frontend/create_cluster/eks_cluster/components/create_eks_cluster_spec.js @@ -1,12 +1,12 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import CreateEksCluster from '~/create_cluster/eks_cluster/components/create_eks_cluster.vue'; import EksClusterConfigurationForm from '~/create_cluster/eks_cluster/components/eks_cluster_configuration_form.vue'; import ServiceCredentialsForm from '~/create_cluster/eks_cluster/components/service_credentials_form.vue'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('CreateEksCluster', () => { let vm; @@ -33,7 +33,6 @@ describe('CreateEksCluster', () => { externalLinkIcon, kubernetesIntegrationHelpPath, }, - localVue, store, }); }); diff --git a/spec/frontend/create_cluster/eks_cluster/components/eks_cluster_configuration_form_spec.js b/spec/frontend/create_cluster/eks_cluster/components/eks_cluster_configuration_form_spec.js index 53a6f12c381..8b8791a6b2b 100644 --- a/spec/frontend/create_cluster/eks_cluster/components/eks_cluster_configuration_form_spec.js +++ b/spec/frontend/create_cluster/eks_cluster/components/eks_cluster_configuration_form_spec.js @@ -1,5 +1,5 @@ import { GlFormCheckbox } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; import Vue from 'vue'; import Vuex from 'vuex'; @@ -7,8 +7,7 @@ import EksClusterConfigurationForm from '~/create_cluster/eks_cluster/components import eksClusterFormState from '~/create_cluster/eks_cluster/store/state'; import clusterDropdownStoreState from '~/create_cluster/store/cluster_dropdown/state'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('EksClusterConfigurationForm', () => { let store; @@ -151,7 +150,6 @@ describe('EksClusterConfigurationForm', () => { const buildWrapper = () => { vm = shallowMount(EksClusterConfigurationForm, { - localVue, store, propsData: { gitlabManagedClusterHelpPath: '', diff --git a/spec/frontend/create_cluster/eks_cluster/components/service_credentials_form_spec.js b/spec/frontend/create_cluster/eks_cluster/components/service_credentials_form_spec.js index a0510d46794..a5ac7d5187b 100644 --- a/spec/frontend/create_cluster/eks_cluster/components/service_credentials_form_spec.js +++ b/spec/frontend/create_cluster/eks_cluster/components/service_credentials_form_spec.js @@ -1,11 +1,11 @@ import { GlButton } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import ServiceCredentialsForm from '~/create_cluster/eks_cluster/components/service_credentials_form.vue'; import eksClusterState from '~/create_cluster/eks_cluster/store/state'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('ServiceCredentialsForm', () => { let vm; @@ -33,7 +33,6 @@ describe('ServiceCredentialsForm', () => { createRoleArnHelpPath: '', externalLinkIcon: '', }, - localVue, store, }); }); diff --git a/spec/frontend/create_cluster/gke_cluster/components/gke_machine_type_dropdown_spec.js b/spec/frontend/create_cluster/gke_cluster/components/gke_machine_type_dropdown_spec.js index 2b6f2134553..c2cd2104551 100644 --- a/spec/frontend/create_cluster/gke_cluster/components/gke_machine_type_dropdown_spec.js +++ b/spec/frontend/create_cluster/gke_cluster/components/gke_machine_type_dropdown_spec.js @@ -1,4 +1,5 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import GkeMachineTypeDropdown from '~/create_cluster/gke_cluster/components/gke_machine_type_dropdown.vue'; import createState from '~/create_cluster/gke_cluster/store/state'; @@ -19,15 +20,12 @@ const LABELS = { DEFAULT: 'Select machine type', }; -const localVue = createLocalVue(); - -localVue.use(Vuex); +Vue.use(Vuex); const createComponent = (store, propsData = componentConfig) => shallowMount(GkeMachineTypeDropdown, { propsData, store, - localVue, }); const createStore = (initialState = {}, getters = {}) => diff --git a/spec/frontend/create_cluster/gke_cluster/components/gke_network_dropdown_spec.js b/spec/frontend/create_cluster/gke_cluster/components/gke_network_dropdown_spec.js index 23a56766037..addb0ef72a0 100644 --- a/spec/frontend/create_cluster/gke_cluster/components/gke_network_dropdown_spec.js +++ b/spec/frontend/create_cluster/gke_cluster/components/gke_network_dropdown_spec.js @@ -1,12 +1,11 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import ClusterFormDropdown from '~/create_cluster/components/cluster_form_dropdown.vue'; import GkeNetworkDropdown from '~/create_cluster/gke_cluster/components/gke_network_dropdown.vue'; import createClusterDropdownState from '~/create_cluster/store/cluster_dropdown/state'; -const localVue = createLocalVue(); - -localVue.use(Vuex); +Vue.use(Vuex); describe('GkeNetworkDropdown', () => { let wrapper; @@ -54,7 +53,6 @@ describe('GkeNetworkDropdown', () => { shallowMount(GkeNetworkDropdown, { propsData, store, - localVue, }); afterEach(() => { diff --git a/spec/frontend/create_cluster/gke_cluster/components/gke_project_id_dropdown_spec.js b/spec/frontend/create_cluster/gke_cluster/components/gke_project_id_dropdown_spec.js index 2b0acc8cf5d..84ae263f2c5 100644 --- a/spec/frontend/create_cluster/gke_cluster/components/gke_project_id_dropdown_spec.js +++ b/spec/frontend/create_cluster/gke_cluster/components/gke_project_id_dropdown_spec.js @@ -1,4 +1,5 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import GkeProjectIdDropdown from '~/create_cluster/gke_cluster/components/gke_project_id_dropdown.vue'; import createState from '~/create_cluster/gke_cluster/store/state'; @@ -19,9 +20,7 @@ const LABELS = { EMPTY: 'No projects found', }; -const localVue = createLocalVue(); - -localVue.use(Vuex); +Vue.use(Vuex); describe('GkeProjectIdDropdown', () => { let wrapper; @@ -52,7 +51,6 @@ describe('GkeProjectIdDropdown', () => { shallowMount(GkeProjectIdDropdown, { propsData, store, - localVue, }); const bootstrap = (initialState, getters) => { diff --git a/spec/frontend/create_cluster/gke_cluster/components/gke_submit_button_spec.js b/spec/frontend/create_cluster/gke_cluster/components/gke_submit_button_spec.js index 014ed6013bd..2bf9158628c 100644 --- a/spec/frontend/create_cluster/gke_cluster/components/gke_submit_button_spec.js +++ b/spec/frontend/create_cluster/gke_cluster/components/gke_submit_button_spec.js @@ -1,10 +1,9 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import GkeSubmitButton from '~/create_cluster/gke_cluster/components/gke_submit_button.vue'; -const localVue = createLocalVue(); - -localVue.use(Vuex); +Vue.use(Vuex); describe('GkeSubmitButton', () => { let wrapper; @@ -21,7 +20,6 @@ describe('GkeSubmitButton', () => { const buildWrapper = () => shallowMount(GkeSubmitButton, { store, - localVue, }); const bootstrap = () => { diff --git a/spec/frontend/create_cluster/gke_cluster/components/gke_subnetwork_dropdown_spec.js b/spec/frontend/create_cluster/gke_cluster/components/gke_subnetwork_dropdown_spec.js index cfa8a678a9b..9df680d94b5 100644 --- a/spec/frontend/create_cluster/gke_cluster/components/gke_subnetwork_dropdown_spec.js +++ b/spec/frontend/create_cluster/gke_cluster/components/gke_subnetwork_dropdown_spec.js @@ -1,12 +1,11 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import ClusterFormDropdown from '~/create_cluster/components/cluster_form_dropdown.vue'; import GkeSubnetworkDropdown from '~/create_cluster/gke_cluster/components/gke_subnetwork_dropdown.vue'; import createClusterDropdownState from '~/create_cluster/store/cluster_dropdown/state'; -const localVue = createLocalVue(); - -localVue.use(Vuex); +Vue.use(Vuex); describe('GkeSubnetworkDropdown', () => { let wrapper; @@ -41,7 +40,6 @@ describe('GkeSubnetworkDropdown', () => { shallowMount(GkeSubnetworkDropdown, { propsData, store, - localVue, }); afterEach(() => { diff --git a/spec/frontend/cycle_analytics/filter_bar_spec.js b/spec/frontend/cycle_analytics/filter_bar_spec.js index 407f21bd956..5112b038e7c 100644 --- a/spec/frontend/cycle_analytics/filter_bar_spec.js +++ b/spec/frontend/cycle_analytics/filter_bar_spec.js @@ -1,4 +1,5 @@ -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; import Vuex from 'vuex'; @@ -15,8 +16,7 @@ import * as utils from '~/vue_shared/components/filtered_search_bar/filtered_sea import initialFiltersState from '~/vue_shared/components/filtered_search_bar/store/modules/filters/state'; import UrlSync from '~/vue_shared/components/url_sync.vue'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); const milestoneTokenType = 'milestone'; const labelsTokenType = 'labels'; @@ -77,7 +77,6 @@ describe('Filter bar', () => { const createComponent = (initialStore) => { return shallowMount(FilterBar, { - localVue, store: initialStore, propsData: { groupPath: 'foo', diff --git a/spec/frontend/deploy_freeze/components/deploy_freeze_settings_spec.js b/spec/frontend/deploy_freeze/components/deploy_freeze_settings_spec.js index 392652292cf..cc044800e5e 100644 --- a/spec/frontend/deploy_freeze/components/deploy_freeze_settings_spec.js +++ b/spec/frontend/deploy_freeze/components/deploy_freeze_settings_spec.js @@ -1,4 +1,5 @@ -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import DeployFreezeModal from '~/deploy_freeze/components/deploy_freeze_modal.vue'; import DeployFreezeSettings from '~/deploy_freeze/components/deploy_freeze_settings.vue'; @@ -6,8 +7,7 @@ import DeployFreezeTable from '~/deploy_freeze/components/deploy_freeze_table.vu import createStore from '~/deploy_freeze/store'; import { timezoneDataFixture } from '../helpers'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('Deploy freeze settings', () => { let wrapper; @@ -20,7 +20,6 @@ describe('Deploy freeze settings', () => { }); jest.spyOn(store, 'dispatch').mockImplementation(); wrapper = shallowMount(DeployFreezeSettings, { - localVue, store, }); }); diff --git a/spec/frontend/deploy_freeze/components/deploy_freeze_table_spec.js b/spec/frontend/deploy_freeze/components/deploy_freeze_table_spec.js index 403d0dce3fc..ada819b7e64 100644 --- a/spec/frontend/deploy_freeze/components/deploy_freeze_table_spec.js +++ b/spec/frontend/deploy_freeze/components/deploy_freeze_table_spec.js @@ -1,13 +1,13 @@ import { GlModal } from '@gitlab/ui'; -import { createLocalVue, mount } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import DeployFreezeTable from '~/deploy_freeze/components/deploy_freeze_table.vue'; import createStore from '~/deploy_freeze/store'; import { RECEIVE_FREEZE_PERIODS_SUCCESS } from '~/deploy_freeze/store/mutation_types'; import { freezePeriodsFixture, timezoneDataFixture } from '../helpers'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('Deploy freeze table', () => { let wrapper; @@ -21,7 +21,6 @@ describe('Deploy freeze table', () => { jest.spyOn(store, 'dispatch').mockImplementation(); wrapper = mount(DeployFreezeTable, { attachTo: document.body, - localVue, store, }); }; diff --git a/spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js b/spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js index 5f4d4071f29..aea81daecef 100644 --- a/spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js +++ b/spec/frontend/deploy_freeze/components/timezone_dropdown_spec.js @@ -1,12 +1,12 @@ import { GlDropdownItem, GlDropdown } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import createStore from '~/deploy_freeze/store'; import TimezoneDropdown from '~/vue_shared/components/timezone_dropdown.vue'; import { findTzByName, formatTz, timezoneDataFixture } from '../helpers'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('Deploy freeze timezone dropdown', () => { let wrapper; @@ -19,7 +19,6 @@ describe('Deploy freeze timezone dropdown', () => { }); wrapper = shallowMount(TimezoneDropdown, { store, - localVue, propsData: { value: selectedTimezone, timezoneData: timezoneDataFixture, diff --git a/spec/frontend/design_management/components/list/item_spec.js b/spec/frontend/design_management/components/list/item_spec.js index ed105b112be..92cb35bd8d6 100644 --- a/spec/frontend/design_management/components/list/item_spec.js +++ b/spec/frontend/design_management/components/list/item_spec.js @@ -1,11 +1,11 @@ import { GlIcon, GlLoadingIcon, GlIntersectionObserver } from '@gitlab/ui'; -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import VueRouter from 'vue-router'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import Item from '~/design_management/components/list/item.vue'; -const localVue = createLocalVue(); -localVue.use(VueRouter); +Vue.use(VueRouter); const router = new VueRouter(); // Referenced from: gitlab_schema.graphql:DesignVersionEvent @@ -34,7 +34,6 @@ describe('Design management list item component', () => { } = {}) { wrapper = extendedWrapper( shallowMount(Item, { - localVue, router, propsData: { id: imgId, diff --git a/spec/frontend/design_management/components/toolbar/index_spec.js b/spec/frontend/design_management/components/toolbar/index_spec.js index cf872046f53..804b55bda38 100644 --- a/spec/frontend/design_management/components/toolbar/index_spec.js +++ b/spec/frontend/design_management/components/toolbar/index_spec.js @@ -1,12 +1,12 @@ import { GlButton } from '@gitlab/ui'; -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import VueRouter from 'vue-router'; import DeleteButton from '~/design_management/components/delete_button.vue'; import Toolbar from '~/design_management/components/toolbar/index.vue'; import { DESIGNS_ROUTE_NAME } from '~/design_management/router/constants'; -const localVue = createLocalVue(); -localVue.use(VueRouter); +Vue.use(VueRouter); const router = new VueRouter(); const RouterLinkStub = { @@ -28,7 +28,6 @@ describe('Design management toolbar component', () => { updatedAt.setHours(updatedAt.getHours() - 1); wrapper = shallowMount(Toolbar, { - localVue, router, propsData: { id: '1', diff --git a/spec/frontend/design_management/pages/design/index_spec.js b/spec/frontend/design_management/pages/design/index_spec.js index 98e2313e9f2..4477bf4b8e6 100644 --- a/spec/frontend/design_management/pages/design/index_spec.js +++ b/spec/frontend/design_management/pages/design/index_spec.js @@ -1,5 +1,6 @@ import { GlAlert } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import { ApolloMutation } from 'vue-apollo'; import VueRouter from 'vue-router'; import { mockTracking, unmockTracking } from 'helpers/tracking_helper'; @@ -78,8 +79,7 @@ const createDiscussionMutationVariables = { }, }; -const localVue = createLocalVue(); -localVue.use(VueRouter); +Vue.use(VueRouter); describe('Design management design index page', () => { let wrapper; @@ -128,7 +128,6 @@ describe('Design management design index page', () => { ...data, }; }, - localVue, router, }); } diff --git a/spec/frontend/design_management/router_spec.js b/spec/frontend/design_management/router_spec.js index ac5e6895408..03ab79712a4 100644 --- a/spec/frontend/design_management/router_spec.js +++ b/spec/frontend/design_management/router_spec.js @@ -1,5 +1,5 @@ -import { mount, createLocalVue } from '@vue/test-utils'; -import { nextTick } from 'vue'; +import { mount } from '@vue/test-utils'; +import Vue, { nextTick } from 'vue'; import VueRouter from 'vue-router'; import App from '~/design_management/components/app.vue'; import DesignDetail from '~/design_management/pages/design/index.vue'; @@ -9,8 +9,7 @@ import { DESIGNS_ROUTE_NAME, DESIGN_ROUTE_NAME } from '~/design_management/route import '~/commons/bootstrap'; function factory(routeArg) { - const localVue = createLocalVue(); - localVue.use(VueRouter); + Vue.use(VueRouter); window.gon = { sprite_icons: '' }; @@ -20,7 +19,6 @@ function factory(routeArg) { } return mount(App, { - localVue, router, mocks: { $apollo: { diff --git a/spec/frontend/diffs/components/collapsed_files_warning_spec.js b/spec/frontend/diffs/components/collapsed_files_warning_spec.js index 46caeb01132..050d32413ad 100644 --- a/spec/frontend/diffs/components/collapsed_files_warning_spec.js +++ b/spec/frontend/diffs/components/collapsed_files_warning_spec.js @@ -1,5 +1,5 @@ -import { shallowMount, mount, createLocalVue } from '@vue/test-utils'; -import { nextTick } from 'vue'; +import { shallowMount, mount } from '@vue/test-utils'; +import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import CollapsedFilesWarning from '~/diffs/components/collapsed_files_warning.vue'; import { CENTERED_LIMITED_CONTAINER_CLASSES, EVT_EXPAND_ALL_FILES } from '~/diffs/constants'; @@ -23,11 +23,10 @@ async function files(store, count) { } describe('CollapsedFilesWarning', () => { - const localVue = createLocalVue(); let store; let wrapper; - localVue.use(Vuex); + Vue.use(Vuex); const getAlertActionButton = () => wrapper.find(CollapsedFilesWarning).find('button.gl-alert-action:first-child'); @@ -43,7 +42,6 @@ describe('CollapsedFilesWarning', () => { wrapper = mounter(CollapsedFilesWarning, { propsData: { ...propsData, ...props }, - localVue, store, }); }; diff --git a/spec/frontend/diffs/components/compare_versions_spec.js b/spec/frontend/diffs/components/compare_versions_spec.js index c48935bc4f0..1ef927f5e9e 100644 --- a/spec/frontend/diffs/components/compare_versions_spec.js +++ b/spec/frontend/diffs/components/compare_versions_spec.js @@ -1,4 +1,5 @@ -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import getDiffWithCommit from 'test_fixtures/merge_request_diffs/with_commit.json'; import setWindowLocation from 'helpers/set_window_location_helper'; @@ -8,8 +9,7 @@ import CompareVersionsComponent from '~/diffs/components/compare_versions.vue'; import { createStore } from '~/mr_notes/stores'; import diffsMockData from '../mock_data/merge_request_diffs'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); const NEXT_COMMIT_URL = `${TEST_HOST}/?commit_id=next`; const PREV_COMMIT_URL = `${TEST_HOST}/?commit_id=prev`; @@ -30,7 +30,6 @@ describe('CompareVersions', () => { } wrapper = mount(CompareVersionsComponent, { - localVue, store, propsData: { mergeRequestDiffs: diffsMockData, diff --git a/spec/frontend/diffs/components/diff_content_spec.js b/spec/frontend/diffs/components/diff_content_spec.js index 0a7dfc02c65..7d2afe105a5 100644 --- a/spec/frontend/diffs/components/diff_content_spec.js +++ b/spec/frontend/diffs/components/diff_content_spec.js @@ -1,5 +1,6 @@ import { GlLoadingIcon } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import DiffContentComponent from '~/diffs/components/diff_content.vue'; import DiffDiscussions from '~/diffs/components/diff_discussions.vue'; @@ -11,8 +12,7 @@ import NoPreviewViewer from '~/vue_shared/components/diff_viewer/viewers/no_prev import NotDiffableViewer from '~/vue_shared/components/diff_viewer/viewers/not_diffable.vue'; import diffFileMockData from '../mock_data/diff_file'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('DiffContent', () => { let wrapper; @@ -88,7 +88,6 @@ describe('DiffContent', () => { ...defaultProps, ...props, }, - localVue, store: fakeStore, provide: { glFeatures }, }); diff --git a/spec/frontend/diffs/components/diff_discussion_reply_spec.js b/spec/frontend/diffs/components/diff_discussion_reply_spec.js index 9443a441ec2..f03c0357a0e 100644 --- a/spec/frontend/diffs/components/diff_discussion_reply_spec.js +++ b/spec/frontend/diffs/components/diff_discussion_reply_spec.js @@ -1,11 +1,11 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import DiffDiscussionReply from '~/diffs/components/diff_discussion_reply.vue'; import ReplyPlaceholder from '~/notes/components/discussion_reply_placeholder.vue'; import NoteSignedOutWidget from '~/notes/components/note_signed_out_widget.vue'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('DiffDiscussionReply', () => { let wrapper; @@ -15,7 +15,6 @@ describe('DiffDiscussionReply', () => { const createComponent = (props = {}, slots = {}) => { wrapper = shallowMount(DiffDiscussionReply, { store, - localVue, propsData: { ...props, }, diff --git a/spec/frontend/diffs/components/diff_discussions_spec.js b/spec/frontend/diffs/components/diff_discussions_spec.js index bd6f4cd2545..8d0c9b01188 100644 --- a/spec/frontend/diffs/components/diff_discussions_spec.js +++ b/spec/frontend/diffs/components/diff_discussions_spec.js @@ -1,5 +1,5 @@ import { GlIcon } from '@gitlab/ui'; -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import DiffDiscussions from '~/diffs/components/diff_discussions.vue'; import { createStore } from '~/mr_notes/stores'; import DiscussionNotes from '~/notes/components/discussion_notes.vue'; @@ -8,8 +8,6 @@ import TimelineEntryItem from '~/vue_shared/components/notes/timeline_entry_item import '~/behaviors/markdown/render_gfm'; import discussionsMockData from '../mock_data/diff_discussions'; -const localVue = createLocalVue(); - describe('DiffDiscussions', () => { let store; let wrapper; @@ -17,13 +15,12 @@ describe('DiffDiscussions', () => { const createComponent = (props) => { store = createStore(); - wrapper = mount(localVue.extend(DiffDiscussions), { + wrapper = mount(DiffDiscussions, { store, propsData: { discussions: getDiscussionsMockData(), ...props, }, - localVue, }); }; diff --git a/spec/frontend/diffs/components/diff_file_header_spec.js b/spec/frontend/diffs/components/diff_file_header_spec.js index 342b4bfcc50..1beaae6e16d 100644 --- a/spec/frontend/diffs/components/diff_file_header_spec.js +++ b/spec/frontend/diffs/components/diff_file_header_spec.js @@ -1,4 +1,5 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import { cloneDeep } from 'lodash'; import Vuex from 'vuex'; @@ -37,8 +38,7 @@ const diffFile = Object.freeze( }), ); -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('DiffFileHeader component', () => { let wrapper; @@ -103,7 +103,6 @@ describe('DiffFileHeader component', () => { ...props, }, ...options, - localVue, store, }); }; diff --git a/spec/frontend/diffs/components/diff_file_spec.js b/spec/frontend/diffs/components/diff_file_spec.js index dc0ed621a64..e185b817fca 100644 --- a/spec/frontend/diffs/components/diff_file_spec.js +++ b/spec/frontend/diffs/components/diff_file_spec.js @@ -1,6 +1,6 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; import MockAdapter from 'axios-mock-adapter'; -import { nextTick } from 'vue'; +import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import DiffContentComponent from 'jh_else_ce/diffs/components/diff_content.vue'; @@ -70,9 +70,7 @@ function markFileToBeRendered(store, index = 0) { } function createComponent({ file, first = false, last = false, options = {}, props = {} }) { - const localVue = createLocalVue(); - - localVue.use(Vuex); + Vue.use(Vuex); const store = new Vuex.Store({ ...createNotesStore(), @@ -85,7 +83,6 @@ function createComponent({ file, first = false, last = false, options = {}, prop const wrapper = shallowMount(DiffFileComponent, { store, - localVue, propsData: { file, canCurrentUserFork: false, @@ -98,7 +95,6 @@ function createComponent({ file, first = false, last = false, options = {}, prop }); return { - localVue, wrapper, store, }; diff --git a/spec/frontend/diffs/components/no_changes_spec.js b/spec/frontend/diffs/components/no_changes_spec.js index 164c58dc8e4..6903b844e5e 100644 --- a/spec/frontend/diffs/components/no_changes_spec.js +++ b/spec/frontend/diffs/components/no_changes_spec.js @@ -1,12 +1,12 @@ import { GlButton } from '@gitlab/ui'; -import { createLocalVue, shallowMount, mount } from '@vue/test-utils'; +import { shallowMount, mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import NoChanges from '~/diffs/components/no_changes.vue'; import { createStore } from '~/mr_notes/stores'; import diffsMockData from '../mock_data/merge_request_diffs'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); const TEST_TARGET_BRANCH = 'foo'; const TEST_SOURCE_BRANCH = 'dev/update'; @@ -17,7 +17,6 @@ describe('Diff no changes empty state', () => { function createComponent(mountFn = shallowMount) { wrapper = mountFn(NoChanges, { - localVue, store, propsData: { changesEmptyStateIllustration: '', diff --git a/spec/frontend/diffs/components/tree_list_spec.js b/spec/frontend/diffs/components/tree_list_spec.js index 31044b0818c..f03792295df 100644 --- a/spec/frontend/diffs/components/tree_list_spec.js +++ b/spec/frontend/diffs/components/tree_list_spec.js @@ -1,4 +1,5 @@ -import { shallowMount, mount, createLocalVue } from '@vue/test-utils'; +import { shallowMount, mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import TreeList from '~/diffs/components/tree_list.vue'; import createStore from '~/diffs/store/modules'; @@ -8,13 +9,11 @@ describe('Diffs tree list component', () => { let wrapper; let store; const getFileRows = () => wrapper.findAll('.file-row'); - const localVue = createLocalVue(); - localVue.use(Vuex); + Vue.use(Vuex); const createComponent = (mountFn = mount) => { wrapper = mountFn(TreeList, { store, - localVue, propsData: { hideFileStats: false }, }); }; diff --git a/spec/frontend/error_tracking/components/error_details_spec.js b/spec/frontend/error_tracking/components/error_details_spec.js index 77f51193258..02baa31289e 100644 --- a/spec/frontend/error_tracking/components/error_details_spec.js +++ b/spec/frontend/error_tracking/components/error_details_spec.js @@ -7,7 +7,8 @@ import { GlAlert, GlSprintf, } from '@gitlab/ui'; -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import { severityLevel, @@ -27,8 +28,7 @@ import Tracking from '~/tracking'; jest.mock('~/flash'); -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('ErrorDetails', () => { let store; @@ -53,7 +53,6 @@ describe('ErrorDetails', () => { function mountComponent() { wrapper = shallowMount(ErrorDetails, { stubs: { GlButton, GlSprintf }, - localVue, store, mocks, propsData: { diff --git a/spec/frontend/error_tracking/components/error_tracking_list_spec.js b/spec/frontend/error_tracking/components/error_tracking_list_spec.js index 74d5731bbea..fc89e778127 100644 --- a/spec/frontend/error_tracking/components/error_tracking_list_spec.js +++ b/spec/frontend/error_tracking/components/error_tracking_list_spec.js @@ -1,5 +1,6 @@ import { GlEmptyState, GlLoadingIcon, GlFormInput, GlPagination, GlDropdown } from '@gitlab/ui'; -import { createLocalVue, mount } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import stubChildren from 'helpers/stub_children'; import ErrorTrackingActions from '~/error_tracking/components/error_tracking_actions.vue'; @@ -8,8 +9,7 @@ import { trackErrorListViewsOptions, trackErrorStatusUpdateOptions } from '~/err import Tracking from '~/tracking'; import errorsList from './list_mock.json'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('ErrorTrackingList', () => { let store; @@ -32,7 +32,6 @@ describe('ErrorTrackingList', () => { stubs = {}, } = {}) { wrapper = mount(ErrorTrackingList, { - localVue, store, propsData: { indexPath: '/path', diff --git a/spec/frontend/error_tracking_settings/components/app_spec.js b/spec/frontend/error_tracking_settings/components/app_spec.js index 844faff64a1..a67e927910e 100644 --- a/spec/frontend/error_tracking_settings/components/app_spec.js +++ b/spec/frontend/error_tracking_settings/components/app_spec.js @@ -1,6 +1,6 @@ import { GlFormRadioGroup, GlFormRadio, GlFormInputGroup } from '@gitlab/ui'; -import { createLocalVue, shallowMount } from '@vue/test-utils'; -import { nextTick } from 'vue'; +import { shallowMount } from '@vue/test-utils'; +import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import { TEST_HOST } from 'helpers/test_constants'; @@ -10,8 +10,7 @@ import ErrorTrackingForm from '~/error_tracking_settings/components/error_tracki import ProjectDropdown from '~/error_tracking_settings/components/project_dropdown.vue'; import createStore from '~/error_tracking_settings/store'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); const TEST_GITLAB_DSN = 'https://gitlab.example.com/123456'; @@ -22,7 +21,6 @@ describe('error tracking settings app', () => { function mountComponent() { wrapper = extendedWrapper( shallowMount(ErrorTrackingSettings, { - localVue, store, // Override the imported store propsData: { initialEnabled: 'true', diff --git a/spec/frontend/error_tracking_settings/components/error_tracking_form_spec.js b/spec/frontend/error_tracking_settings/components/error_tracking_form_spec.js index 2e8a42dbfe6..69d684faec2 100644 --- a/spec/frontend/error_tracking_settings/components/error_tracking_form_spec.js +++ b/spec/frontend/error_tracking_settings/components/error_tracking_form_spec.js @@ -1,12 +1,12 @@ import { GlFormInput, GlButton } from '@gitlab/ui'; -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import ErrorTrackingForm from '~/error_tracking_settings/components/error_tracking_form.vue'; import createStore from '~/error_tracking_settings/store'; import { defaultProps } from '../mock'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('error tracking settings form', () => { let wrapper; @@ -14,7 +14,6 @@ describe('error tracking settings form', () => { function mountComponent() { wrapper = shallowMount(ErrorTrackingForm, { - localVue, store, propsData: defaultProps, }); diff --git a/spec/frontend/error_tracking_settings/components/project_dropdown_spec.js b/spec/frontend/error_tracking_settings/components/project_dropdown_spec.js index 79518a487d4..bf33d76d834 100644 --- a/spec/frontend/error_tracking_settings/components/project_dropdown_spec.js +++ b/spec/frontend/error_tracking_settings/components/project_dropdown_spec.js @@ -1,19 +1,18 @@ import { GlDropdown, GlDropdownItem } from '@gitlab/ui'; -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import { pick, clone } from 'lodash'; import Vuex from 'vuex'; import ProjectDropdown from '~/error_tracking_settings/components/project_dropdown.vue'; import { defaultProps, projectList, staleProject } from '../mock'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('error tracking settings project dropdown', () => { let wrapper; function mountComponent() { wrapper = shallowMount(ProjectDropdown, { - localVue, propsData: { ...pick( defaultProps, diff --git a/spec/frontend/feature_flags/components/feature_flags_spec.js b/spec/frontend/feature_flags/components/feature_flags_spec.js index db4bdc736de..141db7c0eb3 100644 --- a/spec/frontend/feature_flags/components/feature_flags_spec.js +++ b/spec/frontend/feature_flags/components/feature_flags_spec.js @@ -1,5 +1,6 @@ import { GlAlert, GlEmptyState, GlLoadingIcon } from '@gitlab/ui'; -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import MockAdapter from 'axios-mock-adapter'; import Vuex from 'vuex'; import waitForPromises from 'helpers/wait_for_promises'; @@ -13,8 +14,7 @@ import axios from '~/lib/utils/axios_utils'; import TablePagination from '~/vue_shared/components/pagination/table_pagination.vue'; import { getRequestData } from '../mock_data'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('Feature flags', () => { const mockData = { @@ -45,7 +45,6 @@ describe('Feature flags', () => { const factory = (provide = mockData, fn = mount) => { store = createStore(mockState); wrapper = fn(FeatureFlagsComponent, { - localVue, store, provide, stubs: { diff --git a/spec/frontend/feature_flags/components/new_feature_flag_spec.js b/spec/frontend/feature_flags/components/new_feature_flag_spec.js index fe98b6421d4..f14c674353b 100644 --- a/spec/frontend/feature_flags/components/new_feature_flag_spec.js +++ b/spec/frontend/feature_flags/components/new_feature_flag_spec.js @@ -1,5 +1,6 @@ import { GlAlert } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import { TEST_HOST } from 'spec/test_constants'; import Form from '~/feature_flags/components/form.vue'; @@ -10,8 +11,7 @@ import { allUsersStrategy } from '../mock_data'; const userCalloutId = 'feature_flags_new_version'; const userCalloutsPath = `${TEST_HOST}/user_callouts`; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('New feature flag form', () => { let wrapper; @@ -27,7 +27,6 @@ describe('New feature flag form', () => { wrapper = null; } wrapper = shallowMount(NewFeatureFlag, { - localVue, store, provide: { showUserCallout: true, diff --git a/spec/frontend/feature_flags/components/strategies/gitlab_user_list_spec.js b/spec/frontend/feature_flags/components/strategies/gitlab_user_list_spec.js index 6188672b23b..ebfcba6316b 100644 --- a/spec/frontend/feature_flags/components/strategies/gitlab_user_list_spec.js +++ b/spec/frontend/feature_flags/components/strategies/gitlab_user_list_spec.js @@ -1,5 +1,6 @@ import { GlDropdown, GlDropdownItem, GlSearchBoxByType, GlLoadingIcon } from '@gitlab/ui'; -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import Api from '~/api'; import GitlabUserList from '~/feature_flags/components/strategies/gitlab_user_list.vue'; @@ -12,15 +13,13 @@ const DEFAULT_PROPS = { strategy: userListStrategy, }; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('~/feature_flags/components/strategies/gitlab_user_list.vue', () => { let wrapper; const factory = (props = {}) => mount(GitlabUserList, { - localVue, store: createStore({ projectId: '1' }), propsData: { ...DEFAULT_PROPS, ...props }, }); diff --git a/spec/frontend/feature_flags/components/strategy_spec.js b/spec/frontend/feature_flags/components/strategy_spec.js index 4fdf436bfc4..2464583b636 100644 --- a/spec/frontend/feature_flags/components/strategy_spec.js +++ b/spec/frontend/feature_flags/components/strategy_spec.js @@ -1,5 +1,6 @@ import { GlAlert, GlFormSelect, GlLink, GlToken, GlButton } from '@gitlab/ui'; -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import { last } from 'lodash'; import Vuex from 'vuex'; import Api from '~/api'; @@ -26,8 +27,7 @@ const provide = { environmentsEndpoint: '', }; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('Feature flags strategy', () => { let wrapper; @@ -48,7 +48,7 @@ describe('Feature flags strategy', () => { wrapper.destroy(); wrapper = null; } - wrapper = mount(Strategy, { localVue, store: createStore({ projectId: '1' }), ...opts }); + wrapper = mount(Strategy, { store: createStore({ projectId: '1' }), ...opts }); }; beforeEach(() => { diff --git a/spec/frontend/frequent_items/components/frequent_items_list_item_spec.js b/spec/frontend/frequent_items/components/frequent_items_list_item_spec.js index 5a05265afdc..8220ea16342 100644 --- a/spec/frontend/frequent_items/components/frequent_items_list_item_spec.js +++ b/spec/frontend/frequent_items/components/frequent_items_list_item_spec.js @@ -1,5 +1,6 @@ import { GlButton } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import { trimText } from 'helpers/text_helper'; import { mockTracking, unmockTracking } from 'helpers/tracking_helper'; @@ -8,8 +9,7 @@ import { createStore } from '~/frequent_items/store'; import ProjectAvatar from '~/vue_shared/components/project_avatar.vue'; import { mockProject } from '../mock_data'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('FrequentItemsListItemComponent', () => { let wrapper; @@ -40,7 +40,6 @@ describe('FrequentItemsListItemComponent', () => { provide: { vuexModule: 'frequentProjects', }, - localVue, }); }; diff --git a/spec/frontend/frequent_items/components/frequent_items_list_spec.js b/spec/frontend/frequent_items/components/frequent_items_list_spec.js index c015914c991..5d09a588b1d 100644 --- a/spec/frontend/frequent_items/components/frequent_items_list_spec.js +++ b/spec/frontend/frequent_items/components/frequent_items_list_spec.js @@ -1,12 +1,12 @@ -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import frequentItemsListComponent from '~/frequent_items/components/frequent_items_list.vue'; import frequentItemsListItemComponent from '~/frequent_items/components/frequent_items_list_item.vue'; import { createStore } from '~/frequent_items/store'; import { mockFrequentProjects } from '../mock_data'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('FrequentItemsListComponent', () => { let wrapper; @@ -22,7 +22,6 @@ describe('FrequentItemsListComponent', () => { matcher: 'lab', ...props, }, - localVue, provide: { vuexModule: 'frequentProjects', }, diff --git a/spec/frontend/frequent_items/components/frequent_items_search_input_spec.js b/spec/frontend/frequent_items/components/frequent_items_search_input_spec.js index c9b7e0f3d13..e1e2a42d330 100644 --- a/spec/frontend/frequent_items/components/frequent_items_search_input_spec.js +++ b/spec/frontend/frequent_items/components/frequent_items_search_input_spec.js @@ -1,12 +1,12 @@ import { GlSearchBoxByType } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import { mockTracking, unmockTracking } from 'helpers/tracking_helper'; import searchComponent from '~/frequent_items/components/frequent_items_search_input.vue'; import { createStore } from '~/frequent_items/store'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('FrequentItemsSearchInputComponent', () => { let wrapper; @@ -18,7 +18,6 @@ describe('FrequentItemsSearchInputComponent', () => { shallowMount(searchComponent, { store, propsData: { namespace }, - localVue, provide: { vuexModule: 'frequentProjects', }, diff --git a/spec/frontend/ide/components/branches/search_list_spec.js b/spec/frontend/ide/components/branches/search_list_spec.js index 0efa7af2c6c..35e006a26ce 100644 --- a/spec/frontend/ide/components/branches/search_list_spec.js +++ b/spec/frontend/ide/components/branches/search_list_spec.js @@ -1,13 +1,13 @@ import { GlLoadingIcon } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import Item from '~/ide/components/branches/item.vue'; import List from '~/ide/components/branches/search_list.vue'; import { __ } from '~/locale'; import { branches } from '../../mock_data'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('IDE branches search list', () => { let wrapper; @@ -31,7 +31,6 @@ describe('IDE branches search list', () => { }); wrapper = shallowMount(List, { - localVue, store: fakeStore, }); }; diff --git a/spec/frontend/ide/components/commit_sidebar/editor_header_spec.js b/spec/frontend/ide/components/commit_sidebar/editor_header_spec.js index 50635ffe894..6e4c66cb780 100644 --- a/spec/frontend/ide/components/commit_sidebar/editor_header_spec.js +++ b/spec/frontend/ide/components/commit_sidebar/editor_header_spec.js @@ -1,11 +1,11 @@ -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import EditorHeader from '~/ide/components/commit_sidebar/editor_header.vue'; import { createStore } from '~/ide/stores'; import { file } from '../../helpers'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); const TEST_FILE_PATH = 'test/file/path'; @@ -16,7 +16,6 @@ describe('IDE commit editor header', () => { const createComponent = (fileProps = {}) => { wrapper = mount(EditorHeader, { store, - localVue, propsData: { activeFile: { ...file(TEST_FILE_PATH), diff --git a/spec/frontend/ide/components/error_message_spec.js b/spec/frontend/ide/components/error_message_spec.js index 2de3fa863a8..28278aa656f 100644 --- a/spec/frontend/ide/components/error_message_spec.js +++ b/spec/frontend/ide/components/error_message_spec.js @@ -1,10 +1,10 @@ import { GlLoadingIcon } from '@gitlab/ui'; -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import ErrorMessage from '~/ide/components/error_message.vue'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('IDE error message component', () => { let wrapper; @@ -25,7 +25,6 @@ describe('IDE error message component', () => { }, }, store: fakeStore, - localVue, }); }; diff --git a/spec/frontend/ide/components/file_templates/dropdown_spec.js b/spec/frontend/ide/components/file_templates/dropdown_spec.js index 44ac9aa954d..426a65dd918 100644 --- a/spec/frontend/ide/components/file_templates/dropdown_spec.js +++ b/spec/frontend/ide/components/file_templates/dropdown_spec.js @@ -1,11 +1,11 @@ import { GlLoadingIcon } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import $ from 'jquery'; import Vuex from 'vuex'; import Dropdown from '~/ide/components/file_templates/dropdown.vue'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('IDE file templates dropdown component', () => { let wrapper; @@ -44,7 +44,6 @@ describe('IDE file templates dropdown component', () => { ...props, }, store: fakeStore, - localVue, }); ({ element } = wrapper); diff --git a/spec/frontend/ide/components/ide_file_row_spec.js b/spec/frontend/ide/components/ide_file_row_spec.js index 20c105460f2..5f287078aa1 100644 --- a/spec/frontend/ide/components/ide_file_row_spec.js +++ b/spec/frontend/ide/components/ide_file_row_spec.js @@ -1,12 +1,12 @@ -import { createLocalVue, mount } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import FileRowExtra from '~/ide/components/file_row_extra.vue'; import IdeFileRow from '~/ide/components/ide_file_row.vue'; import { createStore } from '~/ide/stores'; import FileRow from '~/vue_shared/components/file_row.vue'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); const TEST_EXTRA_PROPS = { testattribute: 'abc', @@ -30,7 +30,6 @@ describe('Ide File Row component', () => { ...props, }, store: createStore(), - localVue, ...options, }); }; diff --git a/spec/frontend/ide/components/ide_review_spec.js b/spec/frontend/ide/components/ide_review_spec.js index 7a92f59641f..47270b6e1e9 100644 --- a/spec/frontend/ide/components/ide_review_spec.js +++ b/spec/frontend/ide/components/ide_review_spec.js @@ -1,4 +1,4 @@ -import { createLocalVue, mount } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import Vue from 'vue'; import Vuex from 'vuex'; import { keepAlive } from 'helpers/keep_alive_component_helper'; @@ -9,8 +9,7 @@ import { createStore } from '~/ide/stores'; import { file } from '../helpers'; import { projectData } from '../mock_data'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('IDE review mode', () => { let wrapper; @@ -28,7 +27,6 @@ describe('IDE review mode', () => { wrapper = mount(keepAlive(IdeReview), { store, - localVue, }); }); diff --git a/spec/frontend/ide/components/ide_side_bar_spec.js b/spec/frontend/ide/components/ide_side_bar_spec.js index c683612b142..af8f6b79c7f 100644 --- a/spec/frontend/ide/components/ide_side_bar_spec.js +++ b/spec/frontend/ide/components/ide_side_bar_spec.js @@ -1,5 +1,6 @@ import { GlSkeletonLoading } from '@gitlab/ui'; -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import waitForPromises from 'helpers/wait_for_promises'; import IdeReview from '~/ide/components/ide_review.vue'; @@ -10,8 +11,7 @@ import { leftSidebarViews } from '~/ide/constants'; import { createStore } from '~/ide/stores'; import { projectData } from '../mock_data'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('IdeSidebar', () => { let wrapper; @@ -26,7 +26,6 @@ describe('IdeSidebar', () => { return mount(IdeSidebar, { store, - localVue, }); } diff --git a/spec/frontend/ide/components/ide_spec.js b/spec/frontend/ide/components/ide_spec.js index f8d29fc7b47..37b42001a80 100644 --- a/spec/frontend/ide/components/ide_spec.js +++ b/spec/frontend/ide/components/ide_spec.js @@ -1,4 +1,5 @@ -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import waitForPromises from 'helpers/wait_for_promises'; import CannotPushCodeAlert from '~/ide/components/cannot_push_code_alert.vue'; @@ -9,8 +10,7 @@ import { createStore } from '~/ide/stores'; import { file } from '../helpers'; import { projectData } from '../mock_data'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); const TEST_FORK_IDE_PATH = '/test/ide/path'; @@ -34,7 +34,6 @@ describe('WebIDE', () => { wrapper = shallowMount(Ide, { store, - localVue, }); }; diff --git a/spec/frontend/ide/components/ide_status_list_spec.js b/spec/frontend/ide/components/ide_status_list_spec.js index 036edfb3ec1..371fbc6becd 100644 --- a/spec/frontend/ide/components/ide_status_list_spec.js +++ b/spec/frontend/ide/components/ide_status_list_spec.js @@ -1,5 +1,6 @@ import { GlLink } from '@gitlab/ui'; -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import IdeStatusList from '~/ide/components/ide_status_list.vue'; import TerminalSyncStatusSafe from '~/ide/components/terminal_sync/terminal_sync_status_safe.vue'; @@ -16,8 +17,7 @@ const TEST_FILE_EDITOR = { }; const TEST_EDITOR_POSITION = `${TEST_FILE_EDITOR.editorRow}:${TEST_FILE_EDITOR.editorColumn}`; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('ide/components/ide_status_list', () => { let activeFileEditor; @@ -42,7 +42,6 @@ describe('ide/components/ide_status_list', () => { }); wrapper = shallowMount(IdeStatusList, { - localVue, store, ...options, }); diff --git a/spec/frontend/ide/components/ide_tree_spec.js b/spec/frontend/ide/components/ide_tree_spec.js index 0792b88aeb6..8465ef9f5f3 100644 --- a/spec/frontend/ide/components/ide_tree_spec.js +++ b/spec/frontend/ide/components/ide_tree_spec.js @@ -1,4 +1,4 @@ -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import Vue from 'vue'; import Vuex from 'vuex'; import { keepAlive } from 'helpers/keep_alive_component_helper'; @@ -7,8 +7,7 @@ import { createStore } from '~/ide/stores'; import { file } from '../helpers'; import { projectData } from '../mock_data'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('IdeTree', () => { let store; @@ -27,7 +26,6 @@ describe('IdeTree', () => { wrapper = mount(keepAlive(IdeTree), { store, - localVue, }); }); diff --git a/spec/frontend/ide/components/jobs/list_spec.js b/spec/frontend/ide/components/jobs/list_spec.js index 8797e07aef1..cb2c9f8f04f 100644 --- a/spec/frontend/ide/components/jobs/list_spec.js +++ b/spec/frontend/ide/components/jobs/list_spec.js @@ -1,11 +1,11 @@ import { GlLoadingIcon } from '@gitlab/ui'; -import { shallowMount, mount, createLocalVue } from '@vue/test-utils'; +import { shallowMount, mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import StageList from '~/ide/components/jobs/list.vue'; import Stage from '~/ide/components/jobs/stage.vue'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); const storeActions = { fetchJobs: jest.fn(), toggleStageCollapsed: jest.fn(), @@ -42,7 +42,6 @@ describe('IDE stages list', () => { ...defaultProps, ...props, }, - localVue, store, }); }; @@ -92,7 +91,6 @@ describe('IDE stages list', () => { wrapper = mount(StageList, { propsData: { ...defaultProps, stages }, store, - localVue, }); }); diff --git a/spec/frontend/ide/components/merge_requests/item_spec.js b/spec/frontend/ide/components/merge_requests/item_spec.js index f0a97a0b10a..d6cf8127b53 100644 --- a/spec/frontend/ide/components/merge_requests/item_spec.js +++ b/spec/frontend/ide/components/merge_requests/item_spec.js @@ -1,4 +1,5 @@ -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import Item from '~/ide/components/merge_requests/item.vue'; import { createRouter } from '~/ide/ide_router'; @@ -11,8 +12,7 @@ const TEST_ITEM = { }; describe('IDE merge request item', () => { - const localVue = createLocalVue(); - localVue.use(Vuex); + Vue.use(Vuex); let wrapper; let store; @@ -28,7 +28,6 @@ describe('IDE merge request item', () => { currentProjectId: TEST_ITEM.projectPathWithNamespace, ...props, }, - localVue, router, store, }); diff --git a/spec/frontend/ide/components/merge_requests/list_spec.js b/spec/frontend/ide/components/merge_requests/list_spec.js index 610e20d5868..81c7321b22c 100644 --- a/spec/frontend/ide/components/merge_requests/list_spec.js +++ b/spec/frontend/ide/components/merge_requests/list_spec.js @@ -1,13 +1,13 @@ import { GlLoadingIcon } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import Item from '~/ide/components/merge_requests/item.vue'; import List from '~/ide/components/merge_requests/list.vue'; import TokenedInput from '~/ide/components/shared/tokened_input.vue'; import { mergeRequests as mergeRequestsMock } from '../../mock_data'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('IDE merge requests list', () => { let wrapper; @@ -41,7 +41,6 @@ describe('IDE merge requests list', () => { wrapper = shallowMount(List, { store: fakeStore, - localVue, }); }; diff --git a/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js b/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js index 7216f50b05c..7f2ee0fe7d9 100644 --- a/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js +++ b/spec/frontend/ide/components/panes/collapsible_sidebar_spec.js @@ -1,12 +1,12 @@ -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import IdeSidebarNav from '~/ide/components/ide_sidebar_nav.vue'; import CollapsibleSidebar from '~/ide/components/panes/collapsible_sidebar.vue'; import { createStore } from '~/ide/stores'; import paneModule from '~/ide/stores/modules/pane'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('ide/components/panes/collapsible_sidebar.vue', () => { let wrapper; @@ -17,7 +17,6 @@ describe('ide/components/panes/collapsible_sidebar.vue', () => { const createComponent = (props) => { wrapper = shallowMount(CollapsibleSidebar, { - localVue, store, propsData: { extensionTabs: [], @@ -46,7 +45,7 @@ describe('ide/components/panes/collapsible_sidebar.vue', () => { let extensionTabs; beforeEach(() => { - const FakeComponent = localVue.component(fakeComponentName, { + const FakeComponent = Vue.component(fakeComponentName, { render: () => null, }); diff --git a/spec/frontend/ide/components/panes/right_spec.js b/spec/frontend/ide/components/panes/right_spec.js index c6231d129ff..da9f0286cfb 100644 --- a/spec/frontend/ide/components/panes/right_spec.js +++ b/spec/frontend/ide/components/panes/right_spec.js @@ -1,4 +1,4 @@ -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; import Vue from 'vue'; import Vuex from 'vuex'; import CollapsibleSidebar from '~/ide/components/panes/collapsible_sidebar.vue'; @@ -7,8 +7,7 @@ import { rightSidebarViews } from '~/ide/constants'; import { createStore } from '~/ide/stores'; import extendStore from '~/ide/stores/extend'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('ide/components/panes/right.vue', () => { let wrapper; @@ -18,7 +17,6 @@ describe('ide/components/panes/right.vue', () => { extendStore(store, document.createElement('div')); wrapper = shallowMount(RightPane, { - localVue, store, propsData: { ...props, diff --git a/spec/frontend/ide/components/preview/clientside_spec.js b/spec/frontend/ide/components/preview/clientside_spec.js index b168eec0f16..08e9a069cf6 100644 --- a/spec/frontend/ide/components/preview/clientside_spec.js +++ b/spec/frontend/ide/components/preview/clientside_spec.js @@ -1,5 +1,6 @@ import { GlLoadingIcon } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import smooshpack from 'smooshpack'; import Vuex from 'vuex'; import Clientside from '~/ide/components/preview/clientside.vue'; @@ -9,8 +10,7 @@ jest.mock('smooshpack', () => ({ Manager: jest.fn(), })); -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); const dummyPackageJson = () => ({ raw: JSON.stringify({ @@ -67,7 +67,6 @@ describe('IDE clientside preview', () => { wrapper = shallowMount(Clientside, { store, - localVue, }); }; diff --git a/spec/frontend/ide/components/repo_tab_spec.js b/spec/frontend/ide/components/repo_tab_spec.js index 95d52e8f7a9..b16fd8f80ba 100644 --- a/spec/frontend/ide/components/repo_tab_spec.js +++ b/spec/frontend/ide/components/repo_tab_spec.js @@ -1,5 +1,6 @@ import { GlTab } from '@gitlab/ui'; -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import { stubComponent } from 'helpers/stub_component'; import RepoTab from '~/ide/components/repo_tab.vue'; @@ -7,8 +8,7 @@ import { createRouter } from '~/ide/ide_router'; import { createStore } from '~/ide/stores'; import { file } from '../helpers'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); const GlTabStub = stubComponent(GlTab, { template: '<li><slot name="title" /></li>', @@ -23,7 +23,6 @@ describe('RepoTab', () => { function createComponent(propsData) { wrapper = mount(RepoTab, { - localVue, store, propsData, stubs: { diff --git a/spec/frontend/ide/components/repo_tabs_spec.js b/spec/frontend/ide/components/repo_tabs_spec.js index 6ee73b0a437..843c00d9943 100644 --- a/spec/frontend/ide/components/repo_tabs_spec.js +++ b/spec/frontend/ide/components/repo_tabs_spec.js @@ -1,11 +1,11 @@ -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import RepoTabs from '~/ide/components/repo_tabs.vue'; import { createStore } from '~/ide/stores'; import { file } from '../helpers'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('RepoTabs', () => { let wrapper; @@ -22,7 +22,6 @@ describe('RepoTabs', () => { activeFile: file('activeFile'), }, store, - localVue, }); }); diff --git a/spec/frontend/ide/components/resizable_panel_spec.js b/spec/frontend/ide/components/resizable_panel_spec.js index 6a5af52ea35..cdd089c5588 100644 --- a/spec/frontend/ide/components/resizable_panel_spec.js +++ b/spec/frontend/ide/components/resizable_panel_spec.js @@ -1,4 +1,5 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import ResizablePanel from '~/ide/components/resizable_panel.vue'; import { SIDE_LEFT, SIDE_RIGHT } from '~/ide/constants'; @@ -8,8 +9,7 @@ const TEST_WIDTH = 500; const TEST_MIN_WIDTH = 400; describe('~/ide/components/resizable_panel', () => { - const localVue = createLocalVue(); - localVue.use(Vuex); + Vue.use(Vuex); let wrapper; let store; @@ -33,7 +33,6 @@ describe('~/ide/components/resizable_panel', () => { ...props, }, store, - localVue, }); }; const findResizer = () => wrapper.find(PanelResizer); diff --git a/spec/frontend/ide/components/terminal/session_spec.js b/spec/frontend/ide/components/terminal/session_spec.js index 5659a7d15da..c988138e9c4 100644 --- a/spec/frontend/ide/components/terminal/session_spec.js +++ b/spec/frontend/ide/components/terminal/session_spec.js @@ -1,5 +1,6 @@ import { GlButton } from '@gitlab/ui'; -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import TerminalSession from '~/ide/components/terminal/session.vue'; import Terminal from '~/ide/components/terminal/terminal.vue'; @@ -13,8 +14,7 @@ import { const TEST_TERMINAL_PATH = 'terminal/path'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('IDE TerminalSession', () => { let wrapper; @@ -33,7 +33,6 @@ describe('IDE TerminalSession', () => { }); wrapper = shallowMount(TerminalSession, { - localVue, store, ...options, }); diff --git a/spec/frontend/ide/components/terminal/view_spec.js b/spec/frontend/ide/components/terminal/view_spec.js index e97d4d8a73b..49f9513d2ac 100644 --- a/spec/frontend/ide/components/terminal/view_spec.js +++ b/spec/frontend/ide/components/terminal/view_spec.js @@ -1,4 +1,5 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import waitForPromises from 'helpers/wait_for_promises'; import { TEST_HOST } from 'spec/test_constants'; @@ -9,8 +10,7 @@ import TerminalView from '~/ide/components/terminal/view.vue'; const TEST_HELP_PATH = `${TEST_HOST}/help`; const TEST_SVG_PATH = `${TEST_HOST}/illustration.svg`; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('IDE TerminalView', () => { let state; @@ -30,7 +30,7 @@ describe('IDE TerminalView', () => { }, }); - wrapper = shallowMount(TerminalView, { localVue, store }); + wrapper = shallowMount(TerminalView, { store }); // Uses deferred components, so wait for those to load... await waitForPromises(); diff --git a/spec/frontend/ide/components/terminal_sync/terminal_sync_status_safe_spec.js b/spec/frontend/ide/components/terminal_sync/terminal_sync_status_safe_spec.js index 69077ef2c68..f921037d744 100644 --- a/spec/frontend/ide/components/terminal_sync/terminal_sync_status_safe_spec.js +++ b/spec/frontend/ide/components/terminal_sync/terminal_sync_status_safe_spec.js @@ -1,10 +1,10 @@ -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import TerminalSyncStatus from '~/ide/components/terminal_sync/terminal_sync_status.vue'; import TerminalSyncStatusSafe from '~/ide/components/terminal_sync/terminal_sync_status_safe.vue'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('ide/components/terminal_sync/terminal_sync_status_safe', () => { let store; @@ -16,7 +16,6 @@ describe('ide/components/terminal_sync/terminal_sync_status_safe', () => { }); wrapper = shallowMount(TerminalSyncStatusSafe, { - localVue, store, }); }; diff --git a/spec/frontend/ide/components/terminal_sync/terminal_sync_status_spec.js b/spec/frontend/ide/components/terminal_sync/terminal_sync_status_spec.js index c916c43d1e2..3a326b08fff 100644 --- a/spec/frontend/ide/components/terminal_sync/terminal_sync_status_spec.js +++ b/spec/frontend/ide/components/terminal_sync/terminal_sync_status_spec.js @@ -1,5 +1,6 @@ import { GlLoadingIcon, GlIcon } from '@gitlab/ui'; -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import TerminalSyncStatus from '~/ide/components/terminal_sync/terminal_sync_status.vue'; import { @@ -11,8 +12,7 @@ import { const TEST_MESSAGE = 'lorem ipsum dolar sit'; const START_LOADING = 'START_LOADING'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('ide/components/terminal_sync/terminal_sync_status', () => { let moduleState; @@ -35,7 +35,6 @@ describe('ide/components/terminal_sync/terminal_sync_status', () => { }); wrapper = shallowMount(TerminalSyncStatus, { - localVue, store, }); }; diff --git a/spec/frontend/ide/stores/plugins/terminal_spec.js b/spec/frontend/ide/stores/plugins/terminal_spec.js index d4cdad16ecb..912de88cb39 100644 --- a/spec/frontend/ide/stores/plugins/terminal_spec.js +++ b/spec/frontend/ide/stores/plugins/terminal_spec.js @@ -1,4 +1,4 @@ -import { createLocalVue } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import { TEST_HOST } from 'helpers/test_constants'; import terminalModule from '~/ide/stores/modules/terminal'; @@ -11,8 +11,7 @@ const TEST_DATASET = { eeWebTerminalConfigHelpPath: `${TEST_HOST}/web/terminal/config/help`, eeWebTerminalRunnersHelpPath: `${TEST_HOST}/web/terminal/runners/help`, }; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('ide/stores/extend', () => { let store; diff --git a/spec/frontend/import_entities/import_projects/components/import_projects_table_spec.js b/spec/frontend/import_entities/import_projects/components/import_projects_table_spec.js index 0e748baa313..0b12df83cd1 100644 --- a/spec/frontend/import_entities/import_projects/components/import_projects_table_spec.js +++ b/spec/frontend/import_entities/import_projects/components/import_projects_table_spec.js @@ -1,6 +1,6 @@ import { GlLoadingIcon, GlButton, GlIntersectionObserver, GlFormInput } from '@gitlab/ui'; -import { createLocalVue, shallowMount } from '@vue/test-utils'; -import { nextTick } from 'vue'; +import { shallowMount } from '@vue/test-utils'; +import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import { STATUSES } from '~/import_entities/constants'; import ImportProjectsTable from '~/import_entities/import_projects/components/import_projects_table.vue'; @@ -46,8 +46,7 @@ describe('ImportProjectsTable', () => { filterable, paginatable, } = {}) { - const localVue = createLocalVue(); - localVue.use(Vuex); + Vue.use(Vuex); const store = new Vuex.Store({ state: { ...state(), defaultTargetNamespace: USER_NAMESPACE, ...initialState }, @@ -67,7 +66,6 @@ describe('ImportProjectsTable', () => { }); wrapper = shallowMount(ImportProjectsTable, { - localVue, store, propsData: { providerTitle, diff --git a/spec/frontend/import_entities/import_projects/components/provider_repo_table_row_spec.js b/spec/frontend/import_entities/import_projects/components/provider_repo_table_row_spec.js index 72640f3d601..c8afa9ea57d 100644 --- a/spec/frontend/import_entities/import_projects/components/provider_repo_table_row_spec.js +++ b/spec/frontend/import_entities/import_projects/components/provider_repo_table_row_spec.js @@ -1,6 +1,6 @@ import { GlBadge, GlButton, GlDropdown } from '@gitlab/ui'; -import { createLocalVue, shallowMount } from '@vue/test-utils'; -import { nextTick } from 'vue'; +import { shallowMount } from '@vue/test-utils'; +import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import { STATUSES } from '~/import_entities//constants'; import ImportGroupDropdown from '~/import_entities/components/group_dropdown.vue'; @@ -38,13 +38,11 @@ describe('ProviderRepoTableRow', () => { }; function mountComponent(props) { - const localVue = createLocalVue(); - localVue.use(Vuex); + Vue.use(Vuex); const store = initStore(); wrapper = shallowMount(ProviderRepoTableRow, { - localVue, store, propsData: { availableNamespaces, userNamespace, ...props }, }); diff --git a/spec/frontend/issues/related_merge_requests/components/related_merge_requests_spec.js b/spec/frontend/issues/related_merge_requests/components/related_merge_requests_spec.js index 4d780a674be..6e3d9901d7c 100644 --- a/spec/frontend/issues/related_merge_requests/components/related_merge_requests_spec.js +++ b/spec/frontend/issues/related_merge_requests/components/related_merge_requests_spec.js @@ -1,4 +1,4 @@ -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import MockAdapter from 'axios-mock-adapter'; import mockData from 'test_fixtures/issues/related_merge_requests.json'; import axios from '~/lib/utils/axios_utils'; @@ -7,7 +7,6 @@ import createStore from '~/issues/related_merge_requests/store/index'; import RelatedIssuableItem from '~/issuable/components/related_issuable_item.vue'; const API_ENDPOINT = '/api/v4/projects/2/issues/33/related_merge_requests'; -const localVue = createLocalVue(); describe('RelatedMergeRequests', () => { let wrapper; @@ -21,8 +20,7 @@ describe('RelatedMergeRequests', () => { mock = new MockAdapter(axios); mock.onGet(`${API_ENDPOINT}?per_page=100`).reply(200, mockData, { 'x-total': 2 }); - wrapper = mount(localVue.extend(RelatedMergeRequests), { - localVue, + wrapper = mount(RelatedMergeRequests, { store: createStore(), propsData: { endpoint: API_ENDPOINT, diff --git a/spec/frontend/jobs/components/job_app_spec.js b/spec/frontend/jobs/components/job_app_spec.js index 07e6ee46c41..a6e98013d88 100644 --- a/spec/frontend/jobs/components/job_app_spec.js +++ b/spec/frontend/jobs/components/job_app_spec.js @@ -1,5 +1,6 @@ import { GlLoadingIcon } from '@gitlab/ui'; -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import MockAdapter from 'axios-mock-adapter'; import Vuex from 'vuex'; import delayedJobFixture from 'test_fixtures/jobs/delayed.json'; @@ -16,8 +17,7 @@ import axios from '~/lib/utils/axios_utils'; import job from '../mock_data'; describe('Job App', () => { - const localVue = createLocalVue(); - localVue.use(Vuex); + Vue.use(Vuex); let store; let wrapper; diff --git a/spec/frontend/jobs/components/log/log_spec.js b/spec/frontend/jobs/components/log/log_spec.js index 9a5522ab4cd..7e11738f82e 100644 --- a/spec/frontend/jobs/components/log/log_spec.js +++ b/spec/frontend/jobs/components/log/log_spec.js @@ -1,4 +1,5 @@ -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import Log from '~/jobs/components/log/log.vue'; import { logLinesParserLegacy, logLinesParser } from '~/jobs/store/utils'; @@ -11,12 +12,10 @@ describe('Job Log', () => { let store; let origGon; - const localVue = createLocalVue(); - localVue.use(Vuex); + Vue.use(Vuex); const createComponent = () => { wrapper = mount(Log, { - localVue, store, }); }; @@ -91,12 +90,10 @@ describe('Job Log, infinitelyCollapsibleSections feature flag enabled', () => { let store; let origGon; - const localVue = createLocalVue(); - localVue.use(Vuex); + Vue.use(Vuex); const createComponent = () => { wrapper = mount(Log, { - localVue, store, }); }; diff --git a/spec/frontend/jobs/components/manual_variables_form_spec.js b/spec/frontend/jobs/components/manual_variables_form_spec.js index a5278af8e33..6faab3ddf31 100644 --- a/spec/frontend/jobs/components/manual_variables_form_spec.js +++ b/spec/frontend/jobs/components/manual_variables_form_spec.js @@ -1,12 +1,10 @@ import { GlSprintf, GlLink } from '@gitlab/ui'; -import { createLocalVue, mount } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import ManualVariablesForm from '~/jobs/components/manual_variables_form.vue'; -const localVue = createLocalVue(); - Vue.use(Vuex); describe('Manual Variables Form', () => { @@ -29,9 +27,8 @@ describe('Manual Variables Form', () => { }); wrapper = extendedWrapper( - mount(localVue.extend(ManualVariablesForm), { + mount(ManualVariablesForm, { propsData: { ...requiredProps, ...props }, - localVue, store, stubs: { GlSprintf, diff --git a/spec/frontend/lib/utils/vuex_module_mappers_spec.js b/spec/frontend/lib/utils/vuex_module_mappers_spec.js index d7e51e4daca..1821a15f677 100644 --- a/spec/frontend/lib/utils/vuex_module_mappers_spec.js +++ b/spec/frontend/lib/utils/vuex_module_mappers_spec.js @@ -1,4 +1,4 @@ -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; import Vue from 'vue'; import Vuex from 'vuex'; import { @@ -10,13 +10,12 @@ import { const TEST_MODULE_NAME = 'testModuleName'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); // setup test component and store ---------------------------------------------- // // These are used to indirectly test `vuex_module_mappers`. -const TestComponent = Vue.extend({ +const TestComponent = { props: { vuexModule: { type: String, @@ -47,7 +46,7 @@ const TestComponent = Vue.extend({ <pre data-testid="state">{{ stateJson }}</pre> <pre data-testid="getters">{{ gettersJson }}</pre> </div>`, -}); +}; const createTestStore = () => { return new Vuex.Store({ @@ -94,7 +93,6 @@ describe('~/lib/utils/vuex_module_mappers', () => { vuexModule: TEST_MODULE_NAME, }, store, - localVue, }); }); diff --git a/spec/frontend/members/components/action_buttons/approve_access_request_button_spec.js b/spec/frontend/members/components/action_buttons/approve_access_request_button_spec.js index 936715e7723..08d7cf3c932 100644 --- a/spec/frontend/members/components/action_buttons/approve_access_request_button_spec.js +++ b/spec/frontend/members/components/action_buttons/approve_access_request_button_spec.js @@ -1,5 +1,6 @@ import { GlButton, GlForm } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import ApproveAccessRequestButton from '~/members/components/action_buttons/approve_access_request_button.vue'; @@ -7,8 +8,7 @@ import { MEMBER_TYPES } from '~/members/constants'; jest.mock('~/lib/utils/csrf', () => ({ token: 'mock-csrf-token' })); -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('ApproveAccessRequestButton', () => { let wrapper; @@ -29,7 +29,6 @@ describe('ApproveAccessRequestButton', () => { const createComponent = (propsData = {}, state) => { wrapper = shallowMount(ApproveAccessRequestButton, { - localVue, store: createStore(state), provide: { namespace: MEMBER_TYPES.accessRequest, diff --git a/spec/frontend/members/components/action_buttons/remove_group_link_button_spec.js b/spec/frontend/members/components/action_buttons/remove_group_link_button_spec.js index f91aef131a1..ca655e36c42 100644 --- a/spec/frontend/members/components/action_buttons/remove_group_link_button_spec.js +++ b/spec/frontend/members/components/action_buttons/remove_group_link_button_spec.js @@ -1,13 +1,13 @@ import { GlButton } from '@gitlab/ui'; -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import RemoveGroupLinkButton from '~/members/components/action_buttons/remove_group_link_button.vue'; import { MEMBER_TYPES } from '~/members/constants'; import { group } from '../../mock_data'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('RemoveGroupLinkButton', () => { let wrapper; @@ -29,7 +29,6 @@ describe('RemoveGroupLinkButton', () => { const createComponent = () => { wrapper = mount(RemoveGroupLinkButton, { - localVue, store: createStore(), provide: { namespace: MEMBER_TYPES.group, diff --git a/spec/frontend/members/components/action_buttons/remove_member_button_spec.js b/spec/frontend/members/components/action_buttons/remove_member_button_spec.js index 1a031cc56d6..0e5b667eb9b 100644 --- a/spec/frontend/members/components/action_buttons/remove_member_button_spec.js +++ b/spec/frontend/members/components/action_buttons/remove_member_button_spec.js @@ -1,13 +1,13 @@ import { GlButton } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import { modalData } from 'jest/members/mock_data'; import RemoveMemberButton from '~/members/components/action_buttons/remove_member_button.vue'; import { MEMBER_TYPES } from '~/members/constants'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('RemoveMemberButton', () => { let wrapper; @@ -33,7 +33,6 @@ describe('RemoveMemberButton', () => { const createComponent = (propsData = {}, state) => { wrapper = shallowMount(RemoveMemberButton, { - localVue, store: createStore(state), provide: { namespace: MEMBER_TYPES.user, diff --git a/spec/frontend/members/components/action_buttons/resend_invite_button_spec.js b/spec/frontend/members/components/action_buttons/resend_invite_button_spec.js index 547e067450c..8e933d16463 100644 --- a/spec/frontend/members/components/action_buttons/resend_invite_button_spec.js +++ b/spec/frontend/members/components/action_buttons/resend_invite_button_spec.js @@ -1,5 +1,6 @@ import { GlButton } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import { createMockDirective, getBinding } from 'helpers/vue_mock_directive'; import ResendInviteButton from '~/members/components/action_buttons/resend_invite_button.vue'; @@ -7,8 +8,7 @@ import { MEMBER_TYPES } from '~/members/constants'; jest.mock('~/lib/utils/csrf', () => ({ token: 'mock-csrf-token' })); -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('ResendInviteButton', () => { let wrapper; @@ -29,7 +29,6 @@ describe('ResendInviteButton', () => { const createComponent = (propsData = {}, state) => { wrapper = shallowMount(ResendInviteButton, { - localVue, store: createStore(state), provide: { namespace: MEMBER_TYPES.invite, diff --git a/spec/frontend/members/components/app_spec.js b/spec/frontend/members/components/app_spec.js index 9590cd9d8d4..4124a1870a6 100644 --- a/spec/frontend/members/components/app_spec.js +++ b/spec/frontend/members/components/app_spec.js @@ -1,6 +1,6 @@ import { GlAlert } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; -import { nextTick } from 'vue'; +import { shallowMount } from '@vue/test-utils'; +import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import * as commonUtils from '~/lib/utils/common_utils'; import MembersApp from '~/members/components/app.vue'; @@ -11,8 +11,7 @@ import { RECEIVE_MEMBER_ROLE_ERROR, HIDE_ERROR } from '~/members/store/mutation_ import mutations from '~/members/store/mutations'; describe('MembersApp', () => { - const localVue = createLocalVue(); - localVue.use(Vuex); + Vue.use(Vuex); let wrapper; let store; @@ -33,7 +32,6 @@ describe('MembersApp', () => { }); wrapper = shallowMount(MembersApp, { - localVue, propsData: { namespace: MEMBER_TYPES.group, tabQueryParamValue: TAB_QUERY_PARAM_VALUES.group, diff --git a/spec/frontend/members/components/filter_sort/filter_sort_container_spec.js b/spec/frontend/members/components/filter_sort/filter_sort_container_spec.js index 16ac52737bc..4ca8a3bdc36 100644 --- a/spec/frontend/members/components/filter_sort/filter_sort_container_spec.js +++ b/spec/frontend/members/components/filter_sort/filter_sort_container_spec.js @@ -1,12 +1,12 @@ -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import FilterSortContainer from '~/members/components/filter_sort/filter_sort_container.vue'; import MembersFilteredSearchBar from '~/members/components/filter_sort/members_filtered_search_bar.vue'; import SortDropdown from '~/members/components/filter_sort/sort_dropdown.vue'; import { MEMBER_TYPES } from '~/members/constants'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('FilterSortContainer', () => { let wrapper; @@ -32,7 +32,6 @@ describe('FilterSortContainer', () => { }); wrapper = shallowMount(FilterSortContainer, { - localVue, store, provide: { namespace: MEMBER_TYPES.user, diff --git a/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js b/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js index 3f47fa024bc..ee2fbbe57b9 100644 --- a/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js +++ b/spec/frontend/members/components/filter_sort/members_filtered_search_bar_spec.js @@ -1,5 +1,6 @@ import { GlFilteredSearchToken } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import setWindowLocation from 'helpers/set_window_location_helper'; import { redirectTo } from '~/lib/utils/url_utility'; @@ -18,8 +19,7 @@ jest.mock('~/lib/utils/url_utility', () => { }; }); -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('MembersFilteredSearchBar', () => { let wrapper; @@ -44,7 +44,6 @@ describe('MembersFilteredSearchBar', () => { }); wrapper = shallowMount(MembersFilteredSearchBar, { - localVue, provide: { sourceId: 1, canManageMembers: true, diff --git a/spec/frontend/members/components/filter_sort/sort_dropdown_spec.js b/spec/frontend/members/components/filter_sort/sort_dropdown_spec.js index d0684acd487..709ad907a38 100644 --- a/spec/frontend/members/components/filter_sort/sort_dropdown_spec.js +++ b/spec/frontend/members/components/filter_sort/sort_dropdown_spec.js @@ -1,13 +1,13 @@ import { GlSorting, GlSortingItem } from '@gitlab/ui'; -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import setWindowLocation from 'helpers/set_window_location_helper'; import * as urlUtilities from '~/lib/utils/url_utility'; import SortDropdown from '~/members/components/filter_sort/sort_dropdown.vue'; import { MEMBER_TYPES } from '~/members/constants'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('SortDropdown', () => { let wrapper; @@ -35,7 +35,6 @@ describe('SortDropdown', () => { }); wrapper = mount(SortDropdown, { - localVue, provide: { sourceId: 1, namespace: MEMBER_TYPES.user, diff --git a/spec/frontend/members/components/modals/leave_modal_spec.js b/spec/frontend/members/components/modals/leave_modal_spec.js index f755f08dbf2..cdbabb2f646 100644 --- a/spec/frontend/members/components/modals/leave_modal_spec.js +++ b/spec/frontend/members/components/modals/leave_modal_spec.js @@ -1,8 +1,8 @@ import { GlModal, GlForm } from '@gitlab/ui'; import { within } from '@testing-library/dom'; -import { mount, createLocalVue, createWrapper } from '@vue/test-utils'; +import { mount, createWrapper } from '@vue/test-utils'; import { cloneDeep } from 'lodash'; -import { nextTick } from 'vue'; +import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import LeaveModal from '~/members/components/modals/leave_modal.vue'; import { LEAVE_MODAL_ID, MEMBER_TYPES } from '~/members/constants'; @@ -12,8 +12,7 @@ import { member } from '../../mock_data'; jest.mock('~/lib/utils/csrf', () => ({ token: 'mock-csrf-token' })); -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('LeaveModal', () => { let wrapper; @@ -34,7 +33,6 @@ describe('LeaveModal', () => { const createComponent = (propsData = {}, state) => { wrapper = mount(LeaveModal, { - localVue, store: createStore(state), provide: { namespace: MEMBER_TYPES.user, diff --git a/spec/frontend/members/components/modals/remove_group_link_modal_spec.js b/spec/frontend/members/components/modals/remove_group_link_modal_spec.js index 313c237f51c..447496910b8 100644 --- a/spec/frontend/members/components/modals/remove_group_link_modal_spec.js +++ b/spec/frontend/members/components/modals/remove_group_link_modal_spec.js @@ -1,7 +1,7 @@ import { GlModal, GlForm } from '@gitlab/ui'; import { within } from '@testing-library/dom'; -import { mount, createLocalVue, createWrapper } from '@vue/test-utils'; -import { nextTick } from 'vue'; +import { mount, createWrapper } from '@vue/test-utils'; +import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import RemoveGroupLinkModal from '~/members/components/modals/remove_group_link_modal.vue'; import { REMOVE_GROUP_LINK_MODAL_ID, MEMBER_TYPES } from '~/members/constants'; @@ -9,8 +9,7 @@ import { group } from '../../mock_data'; jest.mock('~/lib/utils/csrf', () => ({ token: 'mock-csrf-token' })); -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('RemoveGroupLinkModal', () => { let wrapper; @@ -38,7 +37,6 @@ describe('RemoveGroupLinkModal', () => { const createComponent = (state) => { wrapper = mount(RemoveGroupLinkModal, { - localVue, store: createStore(state), provide: { namespace: MEMBER_TYPES.group, diff --git a/spec/frontend/members/components/table/expiration_datepicker_spec.js b/spec/frontend/members/components/table/expiration_datepicker_spec.js index 3c4a9ba37ff..4fb43fbd888 100644 --- a/spec/frontend/members/components/table/expiration_datepicker_spec.js +++ b/spec/frontend/members/components/table/expiration_datepicker_spec.js @@ -1,6 +1,6 @@ import { GlDatepicker } from '@gitlab/ui'; -import { mount, createLocalVue } from '@vue/test-utils'; -import { nextTick } from 'vue'; +import { mount } from '@vue/test-utils'; +import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import { useFakeDate } from 'helpers/fake_date'; import waitForPromises from 'helpers/wait_for_promises'; @@ -8,8 +8,7 @@ import ExpirationDatepicker from '~/members/components/table/expiration_datepick import { MEMBER_TYPES } from '~/members/constants'; import { member } from '../../mock_data'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('ExpirationDatepicker', () => { // March 15th, 2020 3:00 @@ -49,7 +48,6 @@ describe('ExpirationDatepicker', () => { provide: { namespace: MEMBER_TYPES.user, }, - localVue, store: createStore(), mocks: { $toast, diff --git a/spec/frontend/members/components/table/members_table_cell_spec.js b/spec/frontend/members/components/table/members_table_cell_spec.js index 5375ee11736..6575a7c7126 100644 --- a/spec/frontend/members/components/table/members_table_cell_spec.js +++ b/spec/frontend/members/components/table/members_table_cell_spec.js @@ -1,4 +1,5 @@ -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import MembersTableCell from '~/members/components/table/members_table_cell.vue'; import { MEMBER_TYPES } from '~/members/constants'; @@ -36,9 +37,8 @@ describe('MembersTableCell', () => { }, }; - const localVue = createLocalVue(); - localVue.use(Vuex); - localVue.component('WrappedComponent', WrappedComponent); + Vue.use(Vuex); + Vue.component('WrappedComponent', WrappedComponent); const createStore = (state = {}) => { return new Vuex.Store({ @@ -50,7 +50,6 @@ describe('MembersTableCell', () => { const createComponent = (propsData, state) => { wrapper = mount(MembersTableCell, { - localVue, propsData, store: createStore(state), provide: { diff --git a/spec/frontend/members/components/table/members_table_spec.js b/spec/frontend/members/components/table/members_table_spec.js index 580e5edd652..b559afb4512 100644 --- a/spec/frontend/members/components/table/members_table_spec.js +++ b/spec/frontend/members/components/table/members_table_spec.js @@ -1,5 +1,5 @@ import { GlBadge, GlPagination, GlTable } from '@gitlab/ui'; -import { createLocalVue } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import setWindowLocation from 'helpers/set_window_location_helper'; import { mountExtended, extendedWrapper } from 'helpers/vue_test_utils_helper'; @@ -28,8 +28,7 @@ import { pagination, } from '../../mock_data'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('MembersTable', () => { let wrapper; @@ -56,7 +55,6 @@ describe('MembersTable', () => { const createComponent = (state, provide = {}) => { wrapper = mountExtended(MembersTable, { - localVue, propsData: { tabQueryParamValue: TAB_QUERY_PARAM_VALUES.invite, }, diff --git a/spec/frontend/members/components/table/role_dropdown_spec.js b/spec/frontend/members/components/table/role_dropdown_spec.js index a4a4c620921..d4d950e99ba 100644 --- a/spec/frontend/members/components/table/role_dropdown_spec.js +++ b/spec/frontend/members/components/table/role_dropdown_spec.js @@ -1,8 +1,8 @@ import { GlDropdown, GlDropdownItem } from '@gitlab/ui'; import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils'; import { within } from '@testing-library/dom'; -import { mount, createWrapper, createLocalVue } from '@vue/test-utils'; -import { nextTick } from 'vue'; +import { mount, createWrapper } from '@vue/test-utils'; +import Vue, { nextTick } from 'vue'; import Vuex from 'vuex'; import waitForPromises from 'helpers/wait_for_promises'; import { BV_DROPDOWN_SHOW } from '~/lib/utils/constants'; @@ -10,8 +10,7 @@ import RoleDropdown from '~/members/components/table/role_dropdown.vue'; import { MEMBER_TYPES } from '~/members/constants'; import { member } from '../../mock_data'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('RoleDropdown', () => { let wrapper; @@ -42,7 +41,6 @@ describe('RoleDropdown', () => { permissions: {}, ...propsData, }, - localVue, store: createStore(), mocks: { $toast, diff --git a/spec/frontend/merge_conflicts/components/merge_conflict_resolver_app_spec.js b/spec/frontend/merge_conflicts/components/merge_conflict_resolver_app_spec.js index a09edb50f20..fabf65742f5 100644 --- a/spec/frontend/merge_conflicts/components/merge_conflict_resolver_app_spec.js +++ b/spec/frontend/merge_conflicts/components/merge_conflict_resolver_app_spec.js @@ -1,5 +1,6 @@ import { GlSprintf } from '@gitlab/ui'; -import { shallowMount, createLocalVue } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import InlineConflictLines from '~/merge_conflicts/components/inline_conflict_lines.vue'; import ParallelConflictLines from '~/merge_conflicts/components/parallel_conflict_lines.vue'; @@ -8,8 +9,7 @@ import { createStore } from '~/merge_conflicts/store'; import { decorateFiles } from '~/merge_conflicts/utils'; import { conflictsMock } from '../mock_data'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('Merge Conflict Resolver App', () => { let wrapper; diff --git a/spec/frontend/monitoring/components/embeds/embed_group_spec.js b/spec/frontend/monitoring/components/embeds/embed_group_spec.js index 79b223d96e4..f6229afd180 100644 --- a/spec/frontend/monitoring/components/embeds/embed_group_spec.js +++ b/spec/frontend/monitoring/components/embeds/embed_group_spec.js @@ -1,5 +1,6 @@ import { GlButton, GlCard } from '@gitlab/ui'; -import { createLocalVue, mount, shallowMount } from '@vue/test-utils'; +import { mount, shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import { TEST_HOST } from 'helpers/test_constants'; import EmbedGroup from '~/monitoring/components/embeds/embed_group.vue'; @@ -12,8 +13,7 @@ import { multipleEmbedProps, } from './mock_data'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('Embed Group', () => { let wrapper; @@ -23,7 +23,6 @@ describe('Embed Group', () => { function mountComponent({ urls = [TEST_HOST], shallow = true, stubs } = {}) { const mountMethod = shallow ? shallowMount : mount; wrapper = mountMethod(EmbedGroup, { - localVue, store, propsData: { urls, diff --git a/spec/frontend/monitoring/components/embeds/metric_embed_spec.js b/spec/frontend/monitoring/components/embeds/metric_embed_spec.js index 90647f50b14..f9f1be4f277 100644 --- a/spec/frontend/monitoring/components/embeds/metric_embed_spec.js +++ b/spec/frontend/monitoring/components/embeds/metric_embed_spec.js @@ -1,4 +1,5 @@ -import { createLocalVue, shallowMount } from '@vue/test-utils'; +import { shallowMount } from '@vue/test-utils'; +import Vue from 'vue'; import Vuex from 'vuex'; import { setHTMLFixture } from 'helpers/fixtures'; import { TEST_HOST } from 'helpers/test_constants'; @@ -6,8 +7,7 @@ import DashboardPanel from '~/monitoring/components/dashboard_panel.vue'; import MetricEmbed from '~/monitoring/components/embeds/metric_embed.vue'; import { groups, initialState, metricsData, metricsWithData } from './mock_data'; -const localVue = createLocalVue(); -localVue.use(Vuex); +Vue.use(Vuex); describe('MetricEmbed', () => { let wrapper; @@ -17,7 +17,6 @@ describe('MetricEmbed', () => { function mountComponent() { wrapper = shallowMount(MetricEmbed, { - localVue, store, propsData: { dashboardUrl: TEST_HOST, diff --git a/spec/frontend/monitoring/router_spec.js b/spec/frontend/monitoring/router_spec.js index b027d60f61e..7758dd351b7 100644 --- a/spec/frontend/monitoring/router_spec.js +++ b/spec/frontend/monitoring/router_spec.js @@ -1,4 +1,5 @@ -import { mount, createLocalVue } from '@vue/test-utils'; +import { mount } from '@vue/test-utils'; +import Vue from 'vue'; import VueRouter from 'vue-router'; import Dashboard from '~/monitoring/components/dashboard.vue'; import DashboardPage from '~/monitoring/pages/dashboard_page.vue'; @@ -25,8 +26,7 @@ describe('Monitoring router', () => { let store; const createWrapper = (basePath, routeArg) => { - const localVue = createLocalVue(); - localVue.use(VueRouter); + Vue.use(VueRouter); router = createRouter(basePath); if (routeArg !== undefined) { @@ -34,7 +34,6 @@ describe('Monitoring router', () => { } return mount(MockApp, { - localVue, store, router, }); diff --git a/spec/initializers/google_api_client_spec.rb b/spec/initializers/google_api_client_spec.rb new file mode 100644 index 00000000000..0ed82d7debe --- /dev/null +++ b/spec/initializers/google_api_client_spec.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +# Extracted from https://github.com/googleapis/google-api-ruby-client/blob/main/google-apis-core/spec/google/apis/core/http_command_spec.rb + +require 'spec_helper' +require 'google/apis/core/base_service' + +RSpec.describe Google::Apis::Core::HttpCommand do # rubocop:disable RSpec/FilePath + context('with a successful response') do + let(:client) { Google::Apis::Core::BaseService.new('', '').client } + let(:command) { Google::Apis::Core::HttpCommand.new(:get, 'https://www.googleapis.com/zoo/animals') } + + before do + stub_request(:get, 'https://www.googleapis.com/zoo/animals').to_return(body: %(Hello world)) + end + + it 'returns the response body if block not present' do + result = command.execute(client) + expect(result).to eql 'Hello world' + end + + it 'calls block if present' do + expect { |b| command.execute(client, &b) }.to yield_with_args('Hello world', nil) + end + + it 'retries with max elapsed_time and retries' do + expect(Retriable).to receive(:retriable).with( + tries: Google::Apis::RequestOptions.default.retries + 1, + max_elapsed_time: 3600, + base_interval: 1, + multiplier: 2, + on: described_class::RETRIABLE_ERRORS).and_call_original + allow(Retriable).to receive(:retriable).and_call_original + + command.execute(client) + end + end +end diff --git a/spec/lib/gitlab/database/no_cross_db_foreign_keys_spec.rb b/spec/lib/gitlab/database/no_cross_db_foreign_keys_spec.rb index dffe7dfb29d..03634ebeeb9 100644 --- a/spec/lib/gitlab/database/no_cross_db_foreign_keys_spec.rb +++ b/spec/lib/gitlab/database/no_cross_db_foreign_keys_spec.rb @@ -44,7 +44,6 @@ RSpec.describe 'cross-database foreign keys' do dast_site_profiles_pipelines.ci_pipeline_id external_pull_requests.project_id vulnerability_feedback.pipeline_id - vulnerability_occurrence_pipelines.pipeline_id vulnerability_statistics.latest_pipeline_id ).freeze end diff --git a/spec/models/ci/runner_spec.rb b/spec/models/ci/runner_spec.rb index 6830a8daa3b..d1007eee186 100644 --- a/spec/models/ci/runner_spec.rb +++ b/spec/models/ci/runner_spec.rb @@ -23,6 +23,26 @@ RSpec.describe Ci::Runner do end end + describe 'projects association' do + let(:runner) { create(:ci_runner, :project) } + + it 'does not create a cross-database query' do + with_cross_joins_prevented do + expect(runner.projects.count).to eq(1) + end + end + + context 'when ci_runner_projects_disable_joins is disabled' do + before do + stub_feature_flags(ci_runner_projects_disable_joins: false) + end + + it 'creates a cross-database query' do + expect { runner.projects.count }.to raise_error(Database::PreventCrossJoins::CrossJoinAcrossUnsupportedTablesError) + end + end + end + describe 'validation' do it { is_expected.to validate_presence_of(:access_level) } it { is_expected.to validate_presence_of(:runner_type) } @@ -291,6 +311,30 @@ RSpec.describe Ci::Runner do end end + describe '#only_for' do + let_it_be_with_reload(:runner) { create(:ci_runner, :project) } + let_it_be(:project) { runner.projects.first } + + subject { runner.only_for?(project) } + + context 'with matching project' do + it { is_expected.to be_truthy } + end + + context 'without matching project' do + let_it_be(:project) { create(:project) } + + it { is_expected.to be_falsey } + end + + context 'with runner having multiple projects' do + let_it_be(:other_project) { create(:project) } + let_it_be(:runner_project) { create(:ci_runner_project, project: other_project, runner: runner) } + + it { is_expected.to be_falsey } + end + end + describe '#assign_to' do let(:project) { create(:project) } diff --git a/spec/requests/api/internal/base_spec.rb b/spec/requests/api/internal/base_spec.rb index 9aa8aaafc68..b624b95c016 100644 --- a/spec/requests/api/internal/base_spec.rb +++ b/spec/requests/api/internal/base_spec.rb @@ -612,6 +612,30 @@ RSpec.describe API::Internal::Base do expect(json_response["gitaly"]["features"]).to eq('gitaly-feature-mep-mep' => 'false') end end + + context "with a sidechannels enabled for a project" do + before do + stub_feature_flags(gitlab_shell_upload_pack_sidechannel: project) + end + + it "has the use_sidechannel field set to true for that project" do + pull(key, project) + + expect(response).to have_gitlab_http_status(:ok) + expect(json_response["gl_repository"]).to eq("project-#{project.id}") + expect(json_response["gitaly"]["use_sidechannel"]).to eq(true) + end + + it "has the use_sidechannel field set to false for other projects" do + other_project = create(:project, :public, :repository) + + pull(key, other_project) + + expect(response).to have_gitlab_http_status(:ok) + expect(json_response["gl_repository"]).to eq("project-#{other_project.id}") + expect(json_response["gitaly"]["use_sidechannel"]).to eq(false) + end + end end context "git push" do diff --git a/spec/services/concerns/rate_limited_service_spec.rb b/spec/services/concerns/rate_limited_service_spec.rb index f73871b7e44..97f5ca53c0d 100644 --- a/spec/services/concerns/rate_limited_service_spec.rb +++ b/spec/services/concerns/rate_limited_service_spec.rb @@ -6,11 +6,10 @@ RSpec.describe RateLimitedService do let(:key) { :issues_create } let(:scope) { [:project, :current_user] } let(:opts) { { scope: scope, users_allowlist: -> { [User.support_bot.username] } } } - let(:rate_limiter_klass) { ::Gitlab::ApplicationRateLimiter } - let(:rate_limiter_instance) { rate_limiter_klass.new(key, **opts) } + let(:rate_limiter) { ::Gitlab::ApplicationRateLimiter } describe 'RateLimitedError' do - subject { described_class::RateLimitedError.new(key: key, rate_limiter: rate_limiter_instance) } + subject { described_class::RateLimitedError.new(key: key, rate_limiter: rate_limiter) } describe '#headers' do it 'returns a Hash of HTTP headers' do @@ -26,7 +25,7 @@ RSpec.describe RateLimitedService do request = instance_double(Grape::Request) user = instance_double(User) - expect(rate_limiter_klass).to receive(:log_request).with(request, "#{key}_request_limit".to_sym, user) + expect(rate_limiter).to receive(:log_request).with(request, "#{key}_request_limit".to_sym, user) subject.log_request(request, user) end @@ -34,7 +33,7 @@ RSpec.describe RateLimitedService do end describe 'RateLimiterScopedAndKeyed' do - subject { described_class::RateLimiterScopedAndKeyed.new(key: key, opts: opts, rate_limiter_klass: rate_limiter_klass) } + subject { described_class::RateLimiterScopedAndKeyed.new(key: key, opts: opts, rate_limiter: rate_limiter) } describe '#rate_limit!' do let(:project_with_feature_enabled) { create(:project) } @@ -49,13 +48,12 @@ RSpec.describe RateLimitedService do let(:rate_limited_service_issues_create_feature_enabled) { nil } before do - allow(rate_limiter_klass).to receive(:new).with(key, **evaluated_opts).and_return(rate_limiter_instance) stub_feature_flags(rate_limited_service_issues_create: rate_limited_service_issues_create_feature_enabled) end shared_examples 'a service that does not attempt to throttle' do it 'does not attempt to throttle' do - expect(rate_limiter_instance).not_to receive(:throttled?) + expect(rate_limiter).not_to receive(:throttled?) expect(subject.rate_limit!(service)).to be_nil end @@ -63,7 +61,7 @@ RSpec.describe RateLimitedService do shared_examples 'a service that does attempt to throttle' do before do - allow(rate_limiter_instance).to receive(:throttled?).and_return(throttled) + allow(rate_limiter).to receive(:throttled?).and_return(throttled) end context 'when rate limiting is not in effect' do @@ -134,7 +132,7 @@ RSpec.describe RateLimitedService do end before do - allow(RateLimitedService::RateLimiterScopedAndKeyed).to receive(:new).with(key: key, opts: opts, rate_limiter_klass: rate_limiter_klass).and_return(rate_limiter_scoped_and_keyed) + allow(RateLimitedService::RateLimiterScopedAndKeyed).to receive(:new).with(key: key, opts: opts, rate_limiter: rate_limiter).and_return(rate_limiter_scoped_and_keyed) end context 'bypasses rate limiting' do @@ -173,12 +171,12 @@ RSpec.describe RateLimitedService do end before do - allow(RateLimitedService::RateLimiterScopedAndKeyed).to receive(:new).with(key: key, opts: opts, rate_limiter_klass: rate_limiter_klass).and_return(rate_limiter_scoped_and_keyed) + allow(RateLimitedService::RateLimiterScopedAndKeyed).to receive(:new).with(key: key, opts: opts, rate_limiter: rate_limiter).and_return(rate_limiter_scoped_and_keyed) end context 'and applies rate limiting' do it 'raises an RateLimitedService::RateLimitedError exception' do - expect(rate_limiter_scoped_and_keyed).to receive(:rate_limit!).with(subject).and_raise(RateLimitedService::RateLimitedError.new(key: key, rate_limiter: rate_limiter_instance)) + expect(rate_limiter_scoped_and_keyed).to receive(:rate_limit!).with(subject).and_raise(RateLimitedService::RateLimitedError.new(key: key, rate_limiter: rate_limiter)) expect { subject.execute }.to raise_error(RateLimitedService::RateLimitedError) end diff --git a/spec/services/issues/create_service_spec.rb b/spec/services/issues/create_service_spec.rb index b2dcfb5c6d3..b0dd3b9eff1 100644 --- a/spec/services/issues/create_service_spec.rb +++ b/spec/services/issues/create_service_spec.rb @@ -17,7 +17,7 @@ RSpec.describe Issues::CreateService do expect(described_class.rate_limiter_scoped_and_keyed.key).to eq(:issues_create) expect(described_class.rate_limiter_scoped_and_keyed.opts[:scope]).to eq(%i[project current_user external_author]) - expect(described_class.rate_limiter_scoped_and_keyed.rate_limiter_klass).to eq(Gitlab::ApplicationRateLimiter) + expect(described_class.rate_limiter_scoped_and_keyed.rate_limiter).to eq(Gitlab::ApplicationRateLimiter) end end |