Commit ec75980b authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'winniehell-remove-local-vue-analytics' into 'master'

Use global Vue instance in Jest (analytics)

See merge request gitlab-org/gitlab!76399
parents 2d174887 165a756a
import { GlLoadingIcon, GlEmptyState, GlBadge, GlPagination } from '@gitlab/ui'; import { GlLoadingIcon, GlEmptyState, GlBadge, GlPagination } 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 Vuex from 'vuex';
import CodeReviewAnalyticsApp from 'ee/analytics/code_review_analytics/components/app.vue'; import CodeReviewAnalyticsApp from 'ee/analytics/code_review_analytics/components/app.vue';
import FilterBar from 'ee/analytics/code_review_analytics/components/filter_bar.vue'; import FilterBar from 'ee/analytics/code_review_analytics/components/filter_bar.vue';
...@@ -9,8 +10,7 @@ import createMergeRequestsState from 'ee/analytics/code_review_analytics/store/m ...@@ -9,8 +10,7 @@ import createMergeRequestsState from 'ee/analytics/code_review_analytics/store/m
import { TEST_HOST } from 'helpers/test_constants'; import { TEST_HOST } from 'helpers/test_constants';
import createFiltersState from '~/vue_shared/components/filtered_search_bar/store/modules/filters/state'; import createFiltersState from '~/vue_shared/components/filtered_search_bar/store/modules/filters/state';
const localVue = createLocalVue(); Vue.use(Vuex);
localVue.use(Vuex);
describe('CodeReviewAnalyticsApp component', () => { describe('CodeReviewAnalyticsApp component', () => {
let wrapper; let wrapper;
...@@ -57,7 +57,6 @@ describe('CodeReviewAnalyticsApp component', () => { ...@@ -57,7 +57,6 @@ describe('CodeReviewAnalyticsApp component', () => {
const createComponent = (store) => const createComponent = (store) =>
shallowMount(CodeReviewAnalyticsApp, { shallowMount(CodeReviewAnalyticsApp, {
localVue,
store, store,
propsData: { propsData: {
projectId: 1, projectId: 1,
......
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import axios from 'axios'; import axios from 'axios';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import FilterBar from 'ee/analytics/code_review_analytics/components/filter_bar.vue'; import FilterBar from 'ee/analytics/code_review_analytics/components/filter_bar.vue';
import storeConfig from 'ee/analytics/code_review_analytics/store'; import storeConfig from 'ee/analytics/code_review_analytics/store';
...@@ -19,8 +20,7 @@ import * as utils from '~/vue_shared/components/filtered_search_bar/filtered_sea ...@@ -19,8 +20,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 initialFiltersState from '~/vue_shared/components/filtered_search_bar/store/modules/filters/state';
import UrlSync from '~/vue_shared/components/url_sync.vue'; import UrlSync from '~/vue_shared/components/url_sync.vue';
const localVue = createLocalVue(); Vue.use(Vuex);
localVue.use(Vuex);
const milestoneTokenType = 'milestone'; const milestoneTokenType = 'milestone';
const labelsTokenType = 'labels'; const labelsTokenType = 'labels';
...@@ -81,7 +81,6 @@ describe('Filter bar', () => { ...@@ -81,7 +81,6 @@ describe('Filter bar', () => {
function createComponent(initialStore) { function createComponent(initialStore) {
return shallowMount(FilterBar, { return shallowMount(FilterBar, {
localVue,
store: initialStore, store: initialStore,
propsData: { propsData: {
projectPath: 'foo', projectPath: 'foo',
......
import { GlTable } from '@gitlab/ui'; import { GlTable } 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 Vuex from 'vuex';
import MergeRequestTable from 'ee/analytics/code_review_analytics/components/merge_request_table.vue'; import MergeRequestTable from 'ee/analytics/code_review_analytics/components/merge_request_table.vue';
import createState from 'ee/analytics/code_review_analytics/store/modules/merge_requests/state'; import createState from 'ee/analytics/code_review_analytics/store/modules/merge_requests/state';
import { mockMergeRequests } from '../mock_data'; import { mockMergeRequests } from '../mock_data';
const localVue = createLocalVue(); Vue.use(Vuex);
localVue.use(Vuex);
describe('MergeRequestTable component', () => { describe('MergeRequestTable component', () => {
let wrapper; let wrapper;
...@@ -27,7 +27,6 @@ describe('MergeRequestTable component', () => { ...@@ -27,7 +27,6 @@ describe('MergeRequestTable component', () => {
const createComponent = (store) => const createComponent = (store) =>
mount(MergeRequestTable, { mount(MergeRequestTable, {
localVue,
store, store,
}); });
......
import { GlEmptyState } from '@gitlab/ui'; import { GlEmptyState } from '@gitlab/ui';
import { createLocalVue, shallowMount, mount } from '@vue/test-utils'; import { shallowMount, mount } from '@vue/test-utils';
import axios from 'axios'; import axios from 'axios';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import Component from 'ee/analytics/cycle_analytics/components/base.vue'; import Component from 'ee/analytics/cycle_analytics/components/base.vue';
import DurationChart from 'ee/analytics/cycle_analytics/components/duration_chart.vue'; import DurationChart from 'ee/analytics/cycle_analytics/components/duration_chart.vue';
...@@ -48,8 +49,7 @@ const noAccessSvgPath = 'path/to/no/access'; ...@@ -48,8 +49,7 @@ const noAccessSvgPath = 'path/to/no/access';
const emptyStateSvgPath = 'path/to/empty/state'; const emptyStateSvgPath = 'path/to/empty/state';
const stage = null; const stage = null;
const localVue = createLocalVue(); Vue.use(Vuex);
localVue.use(Vuex);
jest.mock('~/flash'); jest.mock('~/flash');
const defaultStubs = { const defaultStubs = {
...@@ -132,7 +132,6 @@ describe('EE Value Stream Analytics component', () => { ...@@ -132,7 +132,6 @@ describe('EE Value Stream Analytics component', () => {
const func = shallow ? shallowMount : mount; const func = shallow ? shallowMount : mount;
const comp = func(Component, { const comp = func(Component, {
localVue,
store, store,
propsData: { propsData: {
emptyStateSvgPath, emptyStateSvgPath,
......
import { GlDropdownItem } from '@gitlab/ui'; import { GlDropdownItem } 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 Vuex from 'vuex';
import DurationChart from 'ee/analytics/cycle_analytics/components/duration_chart.vue'; import DurationChart from 'ee/analytics/cycle_analytics/components/duration_chart.vue';
import StageDropdownFilter from 'ee/analytics/cycle_analytics/components/stage_dropdown_filter.vue'; import StageDropdownFilter from 'ee/analytics/cycle_analytics/components/stage_dropdown_filter.vue';
...@@ -7,8 +8,7 @@ import Scatterplot from 'ee/analytics/shared/components/scatterplot.vue'; ...@@ -7,8 +8,7 @@ import Scatterplot from 'ee/analytics/shared/components/scatterplot.vue';
import ChartSkeletonLoader from '~/vue_shared/components/resizable_chart/skeleton_loader.vue'; import ChartSkeletonLoader from '~/vue_shared/components/resizable_chart/skeleton_loader.vue';
import { allowedStages as stages, durationChartPlottableData as durationData } from '../mock_data'; import { allowedStages as stages, durationChartPlottableData as durationData } from '../mock_data';
const localVue = createLocalVue(); Vue.use(Vuex);
localVue.use(Vuex);
const actionSpies = { const actionSpies = {
fetchDurationData: jest.fn(), fetchDurationData: jest.fn(),
...@@ -41,7 +41,6 @@ function createComponent({ ...@@ -41,7 +41,6 @@ function createComponent({
props = {}, props = {},
} = {}) { } = {}) {
return mountFn(DurationChart, { return mountFn(DurationChart, {
localVue,
store: fakeStore({ initialState, initialGetters }), store: fakeStore({ initialState, initialGetters }),
propsData: { propsData: {
stages, stages,
......
import { GlDropdownItem, GlSegmentedControl, GlSprintf } from '@gitlab/ui'; import { GlDropdownItem, GlSegmentedControl, GlSprintf } from '@gitlab/ui';
import { shallowMount, mount, createLocalVue } from '@vue/test-utils'; import { shallowMount, mount } from '@vue/test-utils';
import axios from 'axios'; import axios from 'axios';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import LabelsSelector from 'ee/analytics/cycle_analytics/components/labels_selector.vue'; import LabelsSelector from 'ee/analytics/cycle_analytics/components/labels_selector.vue';
import TasksByTypeFilters from 'ee/analytics/cycle_analytics/components/tasks_by_type/tasks_by_type_filters.vue'; import TasksByTypeFilters from 'ee/analytics/cycle_analytics/components/tasks_by_type/tasks_by_type_filters.vue';
...@@ -32,15 +33,13 @@ const selectLabelAtIndex = (ctx, index) => { ...@@ -32,15 +33,13 @@ const selectLabelAtIndex = (ctx, index) => {
const mockGroupLabelsRequest = () => new MockAdapter(axios).onGet().reply(200, groupLabels); const mockGroupLabelsRequest = () => new MockAdapter(axios).onGet().reply(200, groupLabels);
let store = null; let store = null;
const localVue = createLocalVue(); Vue.use(Vuex);
localVue.use(Vuex);
jest.mock('~/flash'); jest.mock('~/flash');
function createComponent({ props = {}, mountFn = shallowMount } = {}) { function createComponent({ props = {}, mountFn = shallowMount } = {}) {
store = createStore(); store = createStore();
return mountFn(TasksByTypeFilters, { return mountFn(TasksByTypeFilters, {
localVue,
store: { store: {
...store, ...store,
getters: { getters: {
......
import { GlModal, GlFormInput } from '@gitlab/ui'; import { GlModal, GlFormInput } 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 Vuex from 'vuex';
import { import {
PRESET_OPTIONS_BLANK, PRESET_OPTIONS_BLANK,
...@@ -19,8 +20,7 @@ import { customStageEvents as formEvents, defaultStageConfig, rawCustomStage } f ...@@ -19,8 +20,7 @@ import { customStageEvents as formEvents, defaultStageConfig, rawCustomStage } f
const scrollIntoViewMock = jest.fn(); const scrollIntoViewMock = jest.fn();
HTMLElement.prototype.scrollIntoView = scrollIntoViewMock; HTMLElement.prototype.scrollIntoView = scrollIntoViewMock;
const localVue = createLocalVue(); Vue.use(Vuex);
localVue.use(Vuex);
describe('ValueStreamForm', () => { describe('ValueStreamForm', () => {
let wrapper = null; let wrapper = null;
...@@ -68,7 +68,6 @@ describe('ValueStreamForm', () => { ...@@ -68,7 +68,6 @@ describe('ValueStreamForm', () => {
const createComponent = ({ props = {}, data = {}, stubs = {}, state = {} } = {}) => const createComponent = ({ props = {}, data = {}, stubs = {}, state = {} } = {}) =>
extendedWrapper( extendedWrapper(
shallowMount(ValueStreamForm, { shallowMount(ValueStreamForm, {
localVue,
store: fakeStore({ state }), store: fakeStore({ state }),
data() { data() {
return { return {
......
import { GlDropdown } from '@gitlab/ui'; import { GlDropdown } from '@gitlab/ui';
import { mount, shallowMount, createLocalVue } from '@vue/test-utils'; import { mount, shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import ValueStreamSelect from 'ee/analytics/cycle_analytics/components/value_stream_select.vue'; import ValueStreamSelect from 'ee/analytics/cycle_analytics/components/value_stream_select.vue';
import { mockTracking, unmockTracking } from 'helpers/tracking_helper'; import { mockTracking, unmockTracking } from 'helpers/tracking_helper';
...@@ -7,8 +8,7 @@ import { extendedWrapper } from 'helpers/vue_test_utils_helper'; ...@@ -7,8 +8,7 @@ import { extendedWrapper } from 'helpers/vue_test_utils_helper';
import { findDropdownItemText } from '../helpers'; import { findDropdownItemText } from '../helpers';
import { valueStreams, defaultStageConfig } from '../mock_data'; import { valueStreams, defaultStageConfig } from '../mock_data';
const localVue = createLocalVue(); Vue.use(Vuex);
localVue.use(Vuex);
describe('ValueStreamSelect', () => { describe('ValueStreamSelect', () => {
let wrapper = null; let wrapper = null;
...@@ -41,7 +41,6 @@ describe('ValueStreamSelect', () => { ...@@ -41,7 +41,6 @@ describe('ValueStreamSelect', () => {
const createComponent = ({ data = {}, initialState = {}, mountFn = shallowMount } = {}) => const createComponent = ({ data = {}, initialState = {}, mountFn = shallowMount } = {}) =>
extendedWrapper( extendedWrapper(
mountFn(ValueStreamSelect, { mountFn(ValueStreamSelect, {
localVue,
store: fakeStore({ initialState }), store: fakeStore({ initialState }),
data() { data() {
return { return {
......
import { GlDropdown, GlLoadingIcon, GlSearchBoxByType } from '@gitlab/ui'; import { GlDropdown, GlLoadingIcon, GlSearchBoxByType } from '@gitlab/ui';
import * as Sentry from '@sentry/browser'; import * as Sentry from '@sentry/browser';
import { createLocalVue } from '@vue/test-utils';
import Vue from 'vue'; import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import DevopsAdoptionAddDropdown from 'ee/analytics/devops_reports/devops_adoption/components/devops_adoption_add_dropdown.vue'; import DevopsAdoptionAddDropdown from 'ee/analytics/devops_reports/devops_adoption/components/devops_adoption_add_dropdown.vue';
...@@ -23,7 +22,6 @@ import { ...@@ -23,7 +22,6 @@ import {
genericDeleteErrorMessage, genericDeleteErrorMessage,
} from '../mock_data'; } from '../mock_data';
const localVue = createLocalVue();
Vue.use(VueApollo); Vue.use(VueApollo);
const mutateAdd = jest.fn().mockResolvedValue({ const mutateAdd = jest.fn().mockResolvedValue({
...@@ -59,7 +57,6 @@ describe('DevopsAdoptionAddDropdown', () => { ...@@ -59,7 +57,6 @@ describe('DevopsAdoptionAddDropdown', () => {
]); ]);
wrapper = shallowMountExtended(DevopsAdoptionAddDropdown, { wrapper = shallowMountExtended(DevopsAdoptionAddDropdown, {
localVue,
apolloProvider: mockApollo, apolloProvider: mockApollo,
propsData: { propsData: {
groups: [], groups: [],
......
import { GlAlert, GlTabs } from '@gitlab/ui'; import { GlAlert, GlTabs } from '@gitlab/ui';
import * as Sentry from '@sentry/browser'; import * as Sentry from '@sentry/browser';
import { createLocalVue } from '@vue/test-utils';
import Vue from 'vue'; import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import DevopsAdoptionAddDropdown from 'ee/analytics/devops_reports/devops_adoption/components/devops_adoption_add_dropdown.vue'; import DevopsAdoptionAddDropdown from 'ee/analytics/devops_reports/devops_adoption/components/devops_adoption_add_dropdown.vue';
...@@ -29,7 +28,6 @@ jest.mock('ee/analytics/devops_reports/devops_adoption/utils/cache_updates', () ...@@ -29,7 +28,6 @@ jest.mock('ee/analytics/devops_reports/devops_adoption/utils/cache_updates', ()
addEnabledNamespacesToCache: jest.fn(), addEnabledNamespacesToCache: jest.fn(),
})); }));
const localVue = createLocalVue();
Vue.use(VueApollo); Vue.use(VueApollo);
const NETWORK_ERROR = new Error('foo!'); const NETWORK_ERROR = new Error('foo!');
...@@ -117,7 +115,6 @@ describe('DevopsAdoptionApp', () => { ...@@ -117,7 +115,6 @@ describe('DevopsAdoptionApp', () => {
const { mockApollo, data = {}, provide = {} } = options; const { mockApollo, data = {}, provide = {} } = options;
return shallowMountExtended(DevopsAdoptionApp, { return shallowMountExtended(DevopsAdoptionApp, {
localVue,
apolloProvider: mockApollo, apolloProvider: mockApollo,
provide, provide,
data() { data() {
......
import { GlModal, GlSprintf, GlAlert } from '@gitlab/ui'; import { GlModal, GlSprintf, GlAlert } from '@gitlab/ui';
import * as Sentry from '@sentry/browser'; import * as Sentry from '@sentry/browser';
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import Vue from 'vue'; import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import DevopsAdoptionDeleteModal from 'ee/analytics/devops_reports/devops_adoption/components/devops_adoption_delete_modal.vue'; import DevopsAdoptionDeleteModal from 'ee/analytics/devops_reports/devops_adoption/components/devops_adoption_delete_modal.vue';
...@@ -13,7 +13,6 @@ import { ...@@ -13,7 +13,6 @@ import {
devopsAdoptionNamespaceData, devopsAdoptionNamespaceData,
} from '../mock_data'; } from '../mock_data';
const localVue = createLocalVue();
Vue.use(VueApollo); Vue.use(VueApollo);
const mockEvent = { preventDefault: jest.fn() }; const mockEvent = { preventDefault: jest.fn() };
...@@ -45,7 +44,6 @@ describe('DevopsAdoptionDeleteModal', () => { ...@@ -45,7 +44,6 @@ describe('DevopsAdoptionDeleteModal', () => {
]); ]);
wrapper = shallowMount(DevopsAdoptionDeleteModal, { wrapper = shallowMount(DevopsAdoptionDeleteModal, {
localVue,
apolloProvider: mockApollo, apolloProvider: mockApollo,
propsData: { propsData: {
modalId, modalId,
......
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import { GlStackedColumnChart } from '@gitlab/ui/dist/charts'; import { GlStackedColumnChart } from '@gitlab/ui/dist/charts';
import ChartSkeletonLoader from '~/vue_shared/components/resizable_chart/skeleton_loader.vue'; import ChartSkeletonLoader from '~/vue_shared/components/resizable_chart/skeleton_loader.vue';
...@@ -7,8 +8,7 @@ import getSnapshotsQuery from 'ee/analytics/devops_reports/devops_adoption/graph ...@@ -7,8 +8,7 @@ import getSnapshotsQuery from 'ee/analytics/devops_reports/devops_adoption/graph
import createMockApollo from 'helpers/mock_apollo_helper'; import createMockApollo from 'helpers/mock_apollo_helper';
import { namespaceWithSnapotsData } from '../mock_data'; import { namespaceWithSnapotsData } from '../mock_data';
const localVue = createLocalVue(); Vue.use(VueApollo);
localVue.use(VueApollo);
const mockWithData = jest.fn().mockResolvedValue(namespaceWithSnapotsData); const mockWithData = jest.fn().mockResolvedValue(namespaceWithSnapotsData);
...@@ -23,7 +23,6 @@ describe('DevopsAdoptionOverviewChart', () => { ...@@ -23,7 +23,6 @@ describe('DevopsAdoptionOverviewChart', () => {
const handlers = [[getSnapshotsQuery, mockSnapshotsQuery]]; const handlers = [[getSnapshotsQuery, mockSnapshotsQuery]];
wrapper = shallowMount(DevopsAdoptionOverviewChart, { wrapper = shallowMount(DevopsAdoptionOverviewChart, {
localVue,
provide: { provide: {
groupGid: groupGid:
namespaceWithSnapotsData.data.devopsAdoptionEnabledNamespaces.nodes[0].namespace.id, namespaceWithSnapotsData.data.devopsAdoptionEnabledNamespaces.nodes[0].namespace.id,
......
import { GlSkeletonLoader, GlCard } from '@gitlab/ui'; import { GlSkeletonLoader, GlCard } from '@gitlab/ui';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { merge } from 'lodash'; import { merge } from 'lodash';
import Vue from 'vue'; import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
...@@ -8,7 +8,6 @@ import groupReleaseStatsQuery from 'ee/analytics/group_ci_cd_analytics/graphql/g ...@@ -8,7 +8,6 @@ import groupReleaseStatsQuery from 'ee/analytics/group_ci_cd_analytics/graphql/g
import createMockApollo from 'helpers/mock_apollo_helper'; import createMockApollo from 'helpers/mock_apollo_helper';
import { groupReleaseStatsQueryResponse } from './mock_data'; import { groupReleaseStatsQueryResponse } from './mock_data';
const localVue = createLocalVue();
Vue.use(VueApollo); Vue.use(VueApollo);
describe('Release stats card', () => { describe('Release stats card', () => {
...@@ -16,7 +15,6 @@ describe('Release stats card', () => { ...@@ -16,7 +15,6 @@ describe('Release stats card', () => {
const createComponent = ({ apolloProvider }) => { const createComponent = ({ apolloProvider }) => {
wrapper = shallowMount(ReleaseStatsCard, { wrapper = shallowMount(ReleaseStatsCard, {
localVue,
apolloProvider, apolloProvider,
stubs: { stubs: {
GlCard, GlCard,
......
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import axios from 'axios'; import axios from 'axios';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import FilterBar from 'ee/analytics/merge_request_analytics/components/filter_bar.vue'; import FilterBar from 'ee/analytics/merge_request_analytics/components/filter_bar.vue';
import storeConfig from 'ee/analytics/merge_request_analytics/store'; import storeConfig from 'ee/analytics/merge_request_analytics/store';
...@@ -22,8 +23,7 @@ import * as utils from '~/vue_shared/components/filtered_search_bar/filtered_sea ...@@ -22,8 +23,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 initialFiltersState from '~/vue_shared/components/filtered_search_bar/store/modules/filters/state';
import UrlSync from '~/vue_shared/components/url_sync.vue'; import UrlSync from '~/vue_shared/components/url_sync.vue';
const localVue = createLocalVue(); Vue.use(Vuex);
localVue.use(Vuex);
const sourceBranchTokenType = 'source_branch'; const sourceBranchTokenType = 'source_branch';
const targetBranchTokenType = 'target_branch'; const targetBranchTokenType = 'target_branch';
...@@ -103,7 +103,6 @@ describe('Filter bar', () => { ...@@ -103,7 +103,6 @@ describe('Filter bar', () => {
function createComponent(initialStore, options = {}) { function createComponent(initialStore, options = {}) {
const { type = ITEM_TYPE.PROJECT } = options; const { type = ITEM_TYPE.PROJECT } = options;
return shallowMount(FilterBar, { return shallowMount(FilterBar, {
localVue,
store: initialStore, store: initialStore,
provide: () => ({ provide: () => ({
fullPath: 'foo', fullPath: 'foo',
......
import { GlAlert } from '@gitlab/ui'; import { GlAlert } from '@gitlab/ui';
import { GlAreaChart } from '@gitlab/ui/dist/charts'; import { GlAreaChart } from '@gitlab/ui/dist/charts';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import ThroughputChart from 'ee/analytics/merge_request_analytics/components/throughput_chart.vue'; import ThroughputChart from 'ee/analytics/merge_request_analytics/components/throughput_chart.vue';
import ThroughputStats from 'ee/analytics/merge_request_analytics/components/throughput_stats.vue'; import ThroughputStats from 'ee/analytics/merge_request_analytics/components/throughput_stats.vue';
...@@ -15,8 +16,7 @@ import { ...@@ -15,8 +16,7 @@ import {
fullPath, fullPath,
} from '../mock_data'; } from '../mock_data';
const localVue = createLocalVue(); Vue.use(Vuex);
localVue.use(Vuex);
const defaultQueryVariables = { const defaultQueryVariables = {
assigneeUsername: null, assigneeUsername: null,
...@@ -45,7 +45,6 @@ describe('ThroughputChart', () => { ...@@ -45,7 +45,6 @@ describe('ThroughputChart', () => {
function createComponent(options = {}) { function createComponent(options = {}) {
const { mocks = defaultMocks } = options; const { mocks = defaultMocks } = options;
return shallowMount(ThroughputChart, { return shallowMount(ThroughputChart, {
localVue,
store, store,
mocks, mocks,
provide: { provide: {
......
...@@ -6,7 +6,8 @@ import { ...@@ -6,7 +6,8 @@ import {
GlAvatarsInline, GlAvatarsInline,
GlPagination, GlPagination,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { mount, shallowMount, createLocalVue } from '@vue/test-utils'; import { mount, shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import ThroughputTable from 'ee/analytics/merge_request_analytics/components/throughput_table.vue'; import ThroughputTable from 'ee/analytics/merge_request_analytics/components/throughput_table.vue';
import { import {
...@@ -23,8 +24,7 @@ import { ...@@ -23,8 +24,7 @@ import {
pageInfo, pageInfo,
} from '../mock_data'; } from '../mock_data';
const localVue = createLocalVue(); Vue.use(Vuex);
localVue.use(Vuex);
const defaultQueryVariables = { const defaultQueryVariables = {
assigneeUsername: null, assigneeUsername: null,
...@@ -47,7 +47,6 @@ describe('ThroughputTable', () => { ...@@ -47,7 +47,6 @@ describe('ThroughputTable', () => {
function createComponent(options = {}) { function createComponent(options = {}) {
const { mocks = defaultMocks, func = shallowMount } = options; const { mocks = defaultMocks, func = shallowMount } = options;
return func(ThroughputTable, { return func(ThroughputTable, {
localVue,
store, store,
mocks, mocks,
provide: { provide: {
......
...@@ -7,9 +7,10 @@ import { ...@@ -7,9 +7,10 @@ import {
GlAlert, GlAlert,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { GlColumnChart } from '@gitlab/ui/dist/charts'; import { GlColumnChart } from '@gitlab/ui/dist/charts';
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import axios from 'axios'; import axios from 'axios';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import ProductivityApp from 'ee/analytics/productivity_analytics/components/app.vue'; import ProductivityApp from 'ee/analytics/productivity_analytics/components/app.vue';
import MetricChart from 'ee/analytics/productivity_analytics/components/metric_chart.vue'; import MetricChart from 'ee/analytics/productivity_analytics/components/metric_chart.vue';
...@@ -23,8 +24,7 @@ import * as commonUtils from '~/lib/utils/common_utils'; ...@@ -23,8 +24,7 @@ import * as commonUtils from '~/lib/utils/common_utils';
import httpStatusCodes from '~/lib/utils/http_status'; import httpStatusCodes from '~/lib/utils/http_status';
import * as urlUtils from '~/lib/utils/url_utility'; import * as urlUtils from '~/lib/utils/url_utility';
const localVue = createLocalVue(); Vue.use(Vuex);
localVue.use(Vuex);
describe('ProductivityApp component', () => { describe('ProductivityApp component', () => {
let wrapper; let wrapper;
...@@ -75,7 +75,6 @@ describe('ProductivityApp component', () => { ...@@ -75,7 +75,6 @@ describe('ProductivityApp component', () => {
}, },
}); });
wrapper = shallowMount(ProductivityApp, { wrapper = shallowMount(ProductivityApp, {
localVue,
store: mockStore, store: mockStore,
mixins: [UrlSyncMixin], mixins: [UrlSyncMixin],
propsData: { propsData: {
......
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import FilterDropdowns from 'ee/analytics/productivity_analytics/components/filter_dropdowns.vue'; import FilterDropdowns from 'ee/analytics/productivity_analytics/components/filter_dropdowns.vue';
import { getStoreConfig } from 'ee/analytics/productivity_analytics/store'; import { getStoreConfig } from 'ee/analytics/productivity_analytics/store';
...@@ -6,8 +7,7 @@ import GroupsDropdownFilter from 'ee/analytics/shared/components/groups_dropdown ...@@ -6,8 +7,7 @@ import GroupsDropdownFilter from 'ee/analytics/shared/components/groups_dropdown
import ProjectsDropdownFilter from '~/analytics/shared/components/projects_dropdown_filter.vue'; import ProjectsDropdownFilter from '~/analytics/shared/components/projects_dropdown_filter.vue';
import resetStore from '../helpers'; import resetStore from '../helpers';
const localVue = createLocalVue(); Vue.use(Vuex);
localVue.use(Vuex);
describe('FilterDropdowns component', () => { describe('FilterDropdowns component', () => {
let wrapper; let wrapper;
...@@ -43,7 +43,6 @@ describe('FilterDropdowns component', () => { ...@@ -43,7 +43,6 @@ describe('FilterDropdowns component', () => {
}); });
wrapper = shallowMount(FilterDropdowns, { wrapper = shallowMount(FilterDropdowns, {
localVue,
store: mockStore, store: mockStore,
propsData: {}, propsData: {},
}); });
......
import { GlAlert, GlDropdown, GlDropdownItem, GlModal } from '@gitlab/ui'; import { GlAlert, GlDropdown, GlDropdownItem, GlModal } from '@gitlab/ui';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import DownloadTestCoverage from 'ee/analytics/repository_analytics/components/download_test_coverage.vue'; import DownloadTestCoverage from 'ee/analytics/repository_analytics/components/download_test_coverage.vue';
import SelectProjectsDropdown from 'ee/analytics/repository_analytics/components/select_projects_dropdown.vue'; import SelectProjectsDropdown from 'ee/analytics/repository_analytics/components/select_projects_dropdown.vue';
const localVue = createLocalVue();
describe('Download test coverage component', () => { describe('Download test coverage component', () => {
let wrapper; let wrapper;
...@@ -27,7 +25,6 @@ describe('Download test coverage component', () => { ...@@ -27,7 +25,6 @@ describe('Download test coverage component', () => {
const createComponent = () => { const createComponent = () => {
wrapper = shallowMount(DownloadTestCoverage, { wrapper = shallowMount(DownloadTestCoverage, {
localVue,
data() { data() {
return { return {
hasError: false, hasError: false,
......
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import DownloadTestCoverage from 'ee/analytics/repository_analytics/components/download_test_coverage.vue'; import DownloadTestCoverage from 'ee/analytics/repository_analytics/components/download_test_coverage.vue';
import GroupRepositoryAnalytics, { import GroupRepositoryAnalytics, {
VISIT_EVENT_FEATURE_FLAG, VISIT_EVENT_FEATURE_FLAG,
...@@ -6,14 +6,13 @@ import GroupRepositoryAnalytics, { ...@@ -6,14 +6,13 @@ import GroupRepositoryAnalytics, {
} from 'ee/analytics/repository_analytics/components/group_repository_analytics.vue'; } from 'ee/analytics/repository_analytics/components/group_repository_analytics.vue';
import Api from '~/api'; import Api from '~/api';
const localVue = createLocalVue();
jest.mock('~/api.js'); jest.mock('~/api.js');
describe('Group repository analytics app', () => { describe('Group repository analytics app', () => {
let wrapper; let wrapper;
const createComponent = (glFeatures = {}) => { const createComponent = (glFeatures = {}) => {
wrapper = shallowMount(GroupRepositoryAnalytics, { localVue, provide: { glFeatures } }); wrapper = shallowMount(GroupRepositoryAnalytics, { provide: { glFeatures } });
}; };
afterEach(() => { afterEach(() => {
......
...@@ -5,11 +5,9 @@ import { ...@@ -5,11 +5,9 @@ import {
GlLoadingIcon, GlLoadingIcon,
GlIcon, GlIcon,
} from '@gitlab/ui'; } from '@gitlab/ui';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import SelectProjectsDropdown from 'ee/analytics/repository_analytics/components/select_projects_dropdown.vue'; import SelectProjectsDropdown from 'ee/analytics/repository_analytics/components/select_projects_dropdown.vue';
const localVue = createLocalVue();
describe('Select projects dropdown component', () => { describe('Select projects dropdown component', () => {
let wrapper; let wrapper;
...@@ -22,7 +20,6 @@ describe('Select projects dropdown component', () => { ...@@ -22,7 +20,6 @@ describe('Select projects dropdown component', () => {
const createComponent = ({ data = {}, apolloGroupProjects = {} } = {}) => { const createComponent = ({ data = {}, apolloGroupProjects = {} } = {}) => {
wrapper = shallowMount(SelectProjectsDropdown, { wrapper = shallowMount(SelectProjectsDropdown, {
localVue,
data() { data() {
return { return {
groupProjects: [ groupProjects: [
......
import { GlDeprecatedSkeletonLoading as GlSkeletonLoading } from '@gitlab/ui'; import { GlDeprecatedSkeletonLoading as GlSkeletonLoading } from '@gitlab/ui';
import { GlSingleStat } from '@gitlab/ui/dist/charts'; import { GlSingleStat } from '@gitlab/ui/dist/charts';
import { shallowMount, createLocalVue } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import TestCoverageSummary from 'ee/analytics/repository_analytics/components/test_coverage_summary.vue'; import TestCoverageSummary from 'ee/analytics/repository_analytics/components/test_coverage_summary.vue';
import { extendedWrapper } from 'helpers/vue_test_utils_helper'; import { extendedWrapper } from 'helpers/vue_test_utils_helper';
const localVue = createLocalVue();
describe('Test coverage table component', () => { describe('Test coverage table component', () => {
let wrapper; let wrapper;
...@@ -21,7 +19,6 @@ describe('Test coverage table component', () => { ...@@ -21,7 +19,6 @@ describe('Test coverage table component', () => {
const createComponent = ({ data = {} } = {}) => { const createComponent = ({ data = {} } = {}) => {
wrapper = extendedWrapper( wrapper = extendedWrapper(
shallowMount(TestCoverageSummary, { shallowMount(TestCoverageSummary, {
localVue,
data() { data() {
return { return {
projectCount: null, projectCount: null,
......
import { GlTable } from '@gitlab/ui'; import { GlTable } from '@gitlab/ui';
import { mount, shallowMount, createLocalVue } from '@vue/test-utils'; import { mount, shallowMount } from '@vue/test-utils';
import { nextTick } from 'vue'; import Vue, { nextTick } from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import SelectProjectsDropdown from 'ee/analytics/repository_analytics/components/select_projects_dropdown.vue'; import SelectProjectsDropdown from 'ee/analytics/repository_analytics/components/select_projects_dropdown.vue';
import TestCoverageTable from 'ee/analytics/repository_analytics/components/test_coverage_table.vue'; import TestCoverageTable from 'ee/analytics/repository_analytics/components/test_coverage_table.vue';
...@@ -14,8 +14,7 @@ import { defaultTestCoverageTable, projects } from '../mock_data'; ...@@ -14,8 +14,7 @@ import { defaultTestCoverageTable, projects } from '../mock_data';
jest.mock('~/api.js'); jest.mock('~/api.js');
const localVue = createLocalVue(); Vue.use(VueApollo);
localVue.use(VueApollo);
describe('Test coverage table component', () => { describe('Test coverage table component', () => {
let wrapper; let wrapper;
...@@ -48,7 +47,6 @@ describe('Test coverage table component', () => { ...@@ -48,7 +47,6 @@ describe('Test coverage table component', () => {
wrapper = extendedWrapper( wrapper = extendedWrapper(
mountFn(TestCoverageTable, { mountFn(TestCoverageTable, {
localVue,
apolloProvider: mockApollo, apolloProvider: mockApollo,
data() { data() {
return { return {
......
import { GlAlert } from '@gitlab/ui'; import { GlAlert } from '@gitlab/ui';
import { GlLineChart } from '@gitlab/ui/dist/charts'; import { GlLineChart } from '@gitlab/ui/dist/charts';
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import createMockApollo from 'helpers/mock_apollo_helper'; import createMockApollo from 'helpers/mock_apollo_helper';
import UsageTrendsCountChart from '~/analytics/usage_trends/components/usage_trends_count_chart.vue'; import UsageTrendsCountChart from '~/analytics/usage_trends/components/usage_trends_count_chart.vue';
...@@ -9,8 +10,7 @@ import ChartSkeletonLoader from '~/vue_shared/components/resizable_chart/skeleto ...@@ -9,8 +10,7 @@ import ChartSkeletonLoader from '~/vue_shared/components/resizable_chart/skeleto
import { mockQueryResponse, mockApolloResponse } from '../apollo_mock_data'; import { mockQueryResponse, mockApolloResponse } from '../apollo_mock_data';
import { mockCountsData1 } from '../mock_data'; import { mockCountsData1 } from '../mock_data';
const localVue = createLocalVue(); Vue.use(VueApollo);
localVue.use(VueApollo);
const loadChartErrorMessage = 'My load error message'; const loadChartErrorMessage = 'My load error message';
const noDataMessage = 'My no data message'; const noDataMessage = 'My no data message';
...@@ -39,7 +39,6 @@ describe('UsageTrendsCountChart', () => { ...@@ -39,7 +39,6 @@ describe('UsageTrendsCountChart', () => {
const createComponent = ({ responseHandler }) => { const createComponent = ({ responseHandler }) => {
return shallowMount(UsageTrendsCountChart, { return shallowMount(UsageTrendsCountChart, {
localVue,
apolloProvider: createMockApollo([[statsQuery, responseHandler]]), apolloProvider: createMockApollo([[statsQuery, responseHandler]]),
propsData: { ...mockChartConfig }, propsData: { ...mockChartConfig },
}); });
......
import { GlAlert } from '@gitlab/ui'; import { GlAlert } from '@gitlab/ui';
import { GlAreaChart } from '@gitlab/ui/dist/charts'; import { GlAreaChart } from '@gitlab/ui/dist/charts';
import { createLocalVue, shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import Vue from 'vue';
import VueApollo from 'vue-apollo'; import VueApollo from 'vue-apollo';
import createMockApollo from 'helpers/mock_apollo_helper'; import createMockApollo from 'helpers/mock_apollo_helper';
import UsersChart from '~/analytics/usage_trends/components/users_chart.vue'; import UsersChart from '~/analytics/usage_trends/components/users_chart.vue';
...@@ -13,8 +14,7 @@ import { ...@@ -13,8 +14,7 @@ import {
roundedSortedCountsMonthlyChartData2, roundedSortedCountsMonthlyChartData2,
} from '../mock_data'; } from '../mock_data';
const localVue = createLocalVue(); Vue.use(VueApollo);
localVue.use(VueApollo);
describe('UsersChart', () => { describe('UsersChart', () => {
let wrapper; let wrapper;
...@@ -34,7 +34,6 @@ describe('UsersChart', () => { ...@@ -34,7 +34,6 @@ describe('UsersChart', () => {
endDate: new Date(2020, 10, 1), endDate: new Date(2020, 10, 1),
totalDataPoints: mockCountsData2.length, totalDataPoints: mockCountsData2.length,
}, },
localVue,
apolloProvider: createMockApollo([[usersQuery, queryHandler]]), apolloProvider: createMockApollo([[usersQuery, queryHandler]]),
data() { data() {
return { loadingError }; return { loadingError };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment