Skip to content

Commit 808fe89

Browse files
committed
refactor(createlocalvue): rename createLocalVue to _createLocalVue
Rename createLocalVue to _createLocalVue to indicate private use
1 parent 48f1c14 commit 808fe89

File tree

6 files changed

+24
-15
lines changed

6 files changed

+24
-15
lines changed

packages/server-test-utils/src/renderToString.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { throwError } from 'shared/util'
66
import { createRenderer } from 'vue-server-renderer'
77
import { mergeOptions } from 'shared/merge-options'
88
import config from './config'
9-
import createLocalVue from 'shared/create-local-vue'
9+
import _createLocalVue from 'shared/create-local-vue'
1010
import { validateOptions } from 'shared/validate-options'
1111

1212
Vue.config.productionTip = false
@@ -34,7 +34,7 @@ export default function renderToString(
3434
const vm = createInstance(
3535
component,
3636
mergedOptions,
37-
createLocalVue(options.localVue)
37+
_createLocalVue(options.localVue)
3838
)
3939

4040
return renderer.renderToString(vm)

packages/shared/create-local-vue.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import Vue from 'vue'
44
import cloneDeep from 'lodash/cloneDeep'
55

6-
function createLocalVue(_Vue: Component = Vue): Component {
6+
function _createLocalVue(_Vue: Component = Vue): Component {
77
const instance = _Vue.extend()
88

99
// clone global APIs
@@ -53,4 +53,4 @@ function createLocalVue(_Vue: Component = Vue): Component {
5353
return instance
5454
}
5555

56-
export default createLocalVue
56+
export default _createLocalVue
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @flow
2+
3+
import _createLocalVue from 'shared/create-local-vue'
4+
5+
function createLocalVue(config: VueConfig = {}): Component {
6+
return _createLocalVue(undefined, config)
7+
}
8+
9+
export default createLocalVue

packages/test-utils/src/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import shallowMount from './shallow-mount'
22
import mount from './mount'
33
import { enableAutoDestroy, resetAutoDestroyState } from './auto-destroy'
4-
import createLocalVue from 'shared/create-local-vue'
4+
import _createLocalVue from 'shared/create-local-vue'
55
import RouterLinkStub from './components/RouterLinkStub'
66
import createWrapper from './create-wrapper'
77
import Wrapper from './wrapper'
@@ -18,7 +18,7 @@ function shallow(component, options) {
1818
}
1919

2020
export {
21-
createLocalVue,
21+
_createLocalVue as createLocalVue,
2222
createWrapper,
2323
config,
2424
enableAutoDestroy,

packages/test-utils/src/mount.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import config from './config'
77
import warnIfNoWindow from './warn-if-no-window'
88
import polyfill from './polyfill'
99
import createWrapper from './create-wrapper'
10-
import createLocalVue from 'shared/create-local-vue'
10+
import _createLocalVue from 'shared/create-local-vue'
1111
import { validateOptions } from 'shared/validate-options'
1212

1313
Vue.config.productionTip = false
@@ -20,7 +20,7 @@ export default function mount(component, options = {}) {
2020

2121
addGlobalErrorHandler(Vue)
2222

23-
const _Vue = createLocalVue(options.localVue)
23+
const _Vue = _createLocalVue(options.localVue)
2424

2525
const mergedOptions = mergeOptions(options, config)
2626

test/specs/create-local-vue.spec.js renamed to test/specs/create-local-vue-internal.spec.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Vue from 'vue'
22
import Vuex from 'vuex'
33
import VueRouter from 'vue-router'
4-
import createLocalVue from 'packages/shared/create-local-vue'
4+
import _createLocalVue from 'packages/shared/create-local-vue'
55
import Component from '~resources/components/component.vue'
66
import ComponentWithVuex from '~resources/components/component-with-vuex.vue'
77
import ComponentWithRouter from '~resources/components/component-with-router.vue'
@@ -10,7 +10,7 @@ import { itDoNotRunIf } from 'conditional-specs'
1010

1111
describeWithShallowAndMount('createLocalVue', mountingMethod => {
1212
it('installs Vuex without polluting global Vue', () => {
13-
const localVue = createLocalVue()
13+
const localVue = _createLocalVue()
1414
localVue.use(Vuex)
1515
const store = new Vuex.Store({
1616
state: {
@@ -27,7 +27,7 @@ describeWithShallowAndMount('createLocalVue', mountingMethod => {
2727
})
2828

2929
it('Vuex should work properly with local Vue', async () => {
30-
const localVue = createLocalVue()
30+
const localVue = _createLocalVue()
3131
localVue.use(Vuex)
3232
const store = new Vuex.Store({
3333
state: {
@@ -53,7 +53,7 @@ describeWithShallowAndMount('createLocalVue', mountingMethod => {
5353
})
5454

5555
it('installs Router without polluting global Vue', () => {
56-
const localVue = createLocalVue()
56+
const localVue = _createLocalVue()
5757
localVue.use(VueRouter)
5858
const routes = [{ path: '/foo', component: Component }]
5959
const router = new VueRouter({
@@ -69,7 +69,7 @@ describeWithShallowAndMount('createLocalVue', mountingMethod => {
6969
mountingMethod.name === 'shallowMount',
7070
'Router should work properly with local Vue',
7171
() => {
72-
const localVue = createLocalVue()
72+
const localVue = _createLocalVue()
7373
localVue.use(VueRouter)
7474
const routes = [
7575
{
@@ -102,7 +102,7 @@ describeWithShallowAndMount('createLocalVue', mountingMethod => {
102102
)
103103

104104
it('use can take additional arguments', () => {
105-
const localVue = createLocalVue()
105+
const localVue = _createLocalVue()
106106
const pluginOptions = { foo: 'bar' }
107107
const plugin = {
108108
install: function(_Vue, options) {
@@ -124,7 +124,7 @@ describeWithShallowAndMount('createLocalVue', mountingMethod => {
124124
}
125125

126126
Vue.use(Plugin)
127-
const localVue = createLocalVue()
127+
const localVue = _createLocalVue()
128128
localVue.use(Plugin)
129129

130130
if (localVue._installedPlugins) {

0 commit comments

Comments
 (0)