Skip to content

Commit 135b242

Browse files
refactor: remove unnecessary alias
1 parent d45e248 commit 135b242

34 files changed

+50
-57
lines changed

test/resources/utils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
/* global describe */
22

33
import Vue from 'vue'
4-
import { shallowMount, mount } from '~vue/test-utils'
5-
import { renderToString } from '~vue/server-test-utils'
4+
import { shallowMount, mount } from '@vue/test-utils'
5+
import { renderToString } from '@vue/server-test-utils'
66

77
export const vueVersion = Number(
88
`${Vue.version.split('.')[0]}.${Vue.version.split('.')[1]}`

test/setup/webpack.test.config.js

+4-10
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,15 @@ const rules = [].concat(
2020
)
2121
const externals = nodeExternals({
2222
// we need to whitelist both `create-instance` and files in `shared` package. Otherwise Webpack wont bundle them in the test dev env
23-
whitelist: ['create-instance', /^shared\/.*/]
23+
whitelist: ['@vue/test-utils', '@vue/server-test-utils', 'create-instance', /^shared\/.*/]
2424
})
2525
// define the default aliases
26-
let aliasedFiles = {
27-
'~vue/server-test-utils': `@vue/server-test-utils`,
28-
'~vue/test-utils': `@vue/test-utils`
29-
}
26+
let aliasedFiles = {}
3027
if (process.env.TARGET === 'dev') {
31-
// if we are in dev test mode, we want to alias all files to the src file, not dist
28+
// if we are in dev test mode, we want to alias all files to the src file, not dist
3229
aliasedFiles = {
33-
// we need both as some places import the old alias with ~, others directly test utils package.
3430
'@vue/server-test-utils': `@vue/server-test-utils/src/index.js`,
35-
'@vue/test-utils': `@vue/test-utils/src/index.js`,
36-
'~vue/server-test-utils': `@vue/server-test-utils/src/index.js`,
37-
'~vue/test-utils': `@vue/test-utils/src/index.js`
31+
'@vue/test-utils': `@vue/test-utils/src/index.js`
3832
}
3933
}
4034
module.exports = {

test/specs/components/RouterLink.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { RouterLinkStub } from '~vue/test-utils'
1+
import { RouterLinkStub } from '@vue/test-utils'
22
import { describeWithShallowAndMount } from '~resources/utils'
33

44
describeWithShallowAndMount('RouterLinkStub', mountingMethod => {

test/specs/config.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describeWithShallowAndMount } from '~resources/utils'
22
import ComponentWithProps from '~resources/components/component-with-props.vue'
3-
import { config, createLocalVue } from '~vue/test-utils'
3+
import { config, createLocalVue } from '@vue/test-utils'
44

55
describeWithShallowAndMount('config', mountingMethod => {
66
const sandbox = sinon.createSandbox()

test/specs/create-local-vue.spec.js

+1-1
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 '~vue/test-utils'
4+
import { createLocalVue } from '@vue/test-utils'
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'

test/specs/create-wrapper.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import Vue from 'vue'
2-
import { createWrapper, Wrapper, WrapperArray } from '~vue/test-utils'
2+
import { createWrapper, Wrapper, WrapperArray } from '@vue/test-utils'
33
import Component from '~resources/components/component.vue'
44
import { describeRunIf } from 'conditional-specs'
55

test/specs/external-libraries.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createLocalVue, mount } from '~vue/test-utils'
1+
import { createLocalVue, mount } from '@vue/test-utils'
22
import VeeValidate from 'vee-validate'
33
import { describeWithShallowAndMount } from '~resources/utils'
44

test/specs/mount.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Vue from 'vue'
22
import { compileToFunctions } from 'vue-template-compiler'
3-
import { mount, createLocalVue } from '~vue/test-utils'
3+
import { mount, createLocalVue } from '@vue/test-utils'
44
import Component from '~resources/components/component.vue'
55
import ComponentWithProps from '~resources/components/component-with-props.vue'
66
import ComponentWithMixin from '~resources/components/component-with-mixin.vue'

test/specs/mounting-options/localVue.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
isRunningPhantomJS,
55
vueVersion
66
} from '~resources/utils'
7-
import { createLocalVue, shallowMount, mount } from '~vue/test-utils'
7+
import { createLocalVue, shallowMount, mount } from '@vue/test-utils'
88
import { itSkipIf, itRunIf, itDoNotRunIf } from 'conditional-specs'
99
import Vuex from 'vuex'
1010

test/specs/mounting-options/methods.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { config } from '~vue/test-utils'
1+
import { config } from '@vue/test-utils'
22
import { describeWithShallowAndMount } from '~resources/utils'
33

44
describeWithShallowAndMount('options.methods', mountingMethod => {

test/specs/mounting-options/mocks.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createLocalVue, config } from '~vue/test-utils'
1+
import { createLocalVue, config } from '@vue/test-utils'
22
import Vue from 'vue'
33
import Component from '~resources/components/component.vue'
44
import ComponentWithVuex from '~resources/components/component-with-vuex.vue'

test/specs/mounting-options/propsData.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { shallowMount } from '~vue/test-utils'
1+
import { shallowMount } from '@vue/test-utils'
22
import ComponentWithProps from '~resources/components/component-with-props.vue'
33
import { describeRunIf } from 'conditional-specs'
44

test/specs/mounting-options/provide.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { config } from '~vue/test-utils'
2-
import { createLocalVue } from '~vue/test-utils'
1+
import { config } from '@vue/test-utils'
2+
import { createLocalVue } from '@vue/test-utils'
33
import ComponentWithInject from '~resources/components/component-with-inject.vue'
44
import CompositionComponentWithInject from '~resources/components/component-with-inject-composition.vue'
55
import { injectSupported } from '~resources/utils'

test/specs/mounting-options/scopedSlots.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describeWithShallowAndMount, vueVersion } from '~resources/utils'
2-
import { createLocalVue } from '~vue/test-utils'
2+
import { createLocalVue } from '@vue/test-utils'
33
import ComponentWithScopedSlots from '~resources/components/component-with-scoped-slots.vue'
44
import { itDoNotRunIf } from 'conditional-specs'
55
import Vue from 'vue'

test/specs/mounting-options/slots.spec.js

+7-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import ComponentAsAClass from '~resources/components/component-as-a-class.vue'
55
import ComponentWithParentName from '~resources/components/component-with-parent-name.vue'
66
import { describeWithShallowAndMount, vueVersion } from '~resources/utils'
77
import { itDoNotRunIf } from 'conditional-specs'
8-
import { mount, createLocalVue } from '~vue/test-utils'
8+
import { mount, createLocalVue } from '@vue/test-utils'
99

1010
describeWithShallowAndMount('options.slots', mountingMethod => {
1111
it('mounts component with default slot if passed component in slot object', () => {
@@ -138,8 +138,8 @@ describeWithShallowAndMount('options.slots', mountingMethod => {
138138
require.cache[
139139
require.resolve('vue-template-compiler')
140140
].exports.compileToFunctions = undefined
141-
delete require.cache[require.resolve('../../../packages/test-utils')]
142-
const mountingMethodFresh = require('../../../packages/test-utils')[
141+
delete require.cache[require.resolve('@vue/test-utils')]
142+
const mountingMethodFresh = require('@vue/test-utils')[
143143
mountingMethod.name
144144
]
145145
const message =
@@ -391,11 +391,10 @@ describeWithShallowAndMount('options.slots', mountingMethod => {
391391
const compilerSave =
392392
require.cache[require.resolve('vue-template-compiler')].exports
393393
.compileToFunctions
394-
require.cache[require.resolve('vue-template-compiler')].exports = {
395-
compileToFunctions: undefined
396-
}
397-
delete require.cache[require.resolve('../../../packages/test-utils')]
398-
const mountingMethodFresh = require('../../../packages/test-utils')[
394+
require.cache[require.resolve('vue-template-compiler')].exports.compileToFunctions = undefined
395+
396+
delete require.cache[require.resolve('@vue/test-utils')]
397+
const mountingMethodFresh = require('@vue/test-utils')[
399398
mountingMethod.name
400399
]
401400
const message =

test/specs/mounting-options/stubs.spec.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import ComponentWithChild from '~resources/components/component-with-child.vue'
22
import ComponentWithNestedChildren from '~resources/components/component-with-nested-children.vue'
33
import Component from '~resources/components/component.vue'
44
import ComponentAsAClass from '~resources/components/component-as-a-class.vue'
5-
import { createLocalVue, config } from '~vue/test-utils'
6-
import { config as serverConfig } from '~vue/server-test-utils'
5+
import { createLocalVue, config } from '@vue/test-utils'
6+
import { config as serverConfig } from '@vue/server-test-utils'
77
import Vue from 'vue'
88
import { describeWithShallowAndMount, vueVersion } from '~resources/utils'
99
import { itDoNotRunIf, itSkipIf, itRunIf } from 'conditional-specs'
@@ -263,9 +263,9 @@ describeWithShallowAndMount('options.stub', mountingMethod => {
263263
require.cache[
264264
require.resolve('vue-template-compiler')
265265
].exports.compileToFunctions = undefined
266-
delete require.cache[require.resolve('../../../packages/test-utils')]
267-
delete require.cache[require.resolve('../../../packages/server-test-utils')]
268-
const mountingMethodFresh = require('../../../packages/test-utils')[
266+
delete require.cache[require.resolve('@vue/test-utils')]
267+
delete require.cache[require.resolve('@vue/server-test-utils')]
268+
const mountingMethodFresh = require('@vue/test-utils')[
269269
mountingMethod.name
270270
]
271271
const message =

test/specs/render.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { render } from '~vue/server-test-utils'
1+
import { render } from '@vue/server-test-utils'
22
import Cheerio from 'cheerio'
33
import { describeDoNotRunIf } from 'conditional-specs'
44

test/specs/renderToString.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { renderToString } from '~vue/server-test-utils'
2-
import { createLocalVue } from '~vue/test-utils'
1+
import { renderToString } from '@vue/server-test-utils'
2+
import { createLocalVue } from '@vue/test-utils'
33
import ComponentWithChild from '~resources/components/component-with-child.vue'
44
import { describeDoNotRunIf } from 'conditional-specs'
55

test/specs/shallow-mount.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { compileToFunctions } from 'vue-template-compiler'
22
import Vue from 'vue'
3-
import { mount, shallowMount, createLocalVue } from '~vue/test-utils'
3+
import { mount, shallowMount, createLocalVue } from '@vue/test-utils'
44
import Component from '~resources/components/component.vue'
55
import ComponentWithChild from '~resources/components/component-with-child.vue'
66
import ComponentWithNestedChildren from '~resources/components/component-with-nested-children.vue'

test/specs/wrapper-array.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Wrapper, WrapperArray } from '~vue/test-utils'
1+
import { Wrapper, WrapperArray } from '@vue/test-utils'
22
import { describeWithShallowAndMount } from '~resources/utils'
33

44
describeWithShallowAndMount('WrapperArray', mountingMethod => {

test/specs/wrapper-array/at.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describeWithShallowAndMount } from '~resources/utils'
2-
import '~vue/test-utils'
2+
import '@vue/test-utils'
33

44
describeWithShallowAndMount('at', mountingMethod => {
55
it('returns Wrapper at index', () => {

test/specs/wrapper-array/attributes.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describeWithShallowAndMount } from '~resources/utils'
2-
import '~vue/test-utils'
2+
import '@vue/test-utils'
33

44
describeWithShallowAndMount('attributes', mountingMethod => {
55
it('throws error if wrapper array contains no items', () => {

test/specs/wrapper-array/classes.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describeWithShallowAndMount } from '~resources/utils'
2-
import '~vue/test-utils'
2+
import '@vue/test-utils'
33

44
describeWithShallowAndMount('classes', mountingMethod => {
55
it('throws error if wrapper array contains no items', () => {

test/specs/wrapper-array/contains.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describeWithShallowAndMount } from '~resources/utils'
2-
import '~vue/test-utils'
2+
import '@vue/test-utils'
33

44
describeWithShallowAndMount('contains', mountingMethod => {
55
it('returns true if every Wrapper contains element', () => {

test/specs/wrapper-array/find.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describeWithShallowAndMount } from '~resources/utils'
2-
import '~vue/test-utils'
2+
import '@vue/test-utils'
33

44
describeWithShallowAndMount('find', mountingMethod => {
55
it('throws error if wrapper array contains no items', () => {

test/specs/wrapper-array/findAll.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describeWithShallowAndMount } from '~resources/utils'
22
import { compileToFunctions } from 'vue-template-compiler'
3-
import '~vue/test-utils'
3+
import '@vue/test-utils'
44

55
describeWithShallowAndMount('findAll', mountingMethod => {
66
it('throws error if wrapper array contains no items', () => {

test/specs/wrapper-array/html.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describeWithShallowAndMount } from '~resources/utils'
22
import { compileToFunctions } from 'vue-template-compiler'
3-
import '~vue/test-utils'
3+
import '@vue/test-utils'
44

55
describeWithShallowAndMount('html', mountingMethod => {
66
it('throws error if wrapper array contains no items', () => {

test/specs/wrapper-array/isEmpty.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describeWithShallowAndMount } from '~resources/utils'
22
import { compileToFunctions } from 'vue-template-compiler'
3-
import '~vue/test-utils'
3+
import '@vue/test-utils'
44

55
describeWithShallowAndMount('isEmpty', mountingMethod => {
66
it('returns true if node is empty', () => {

test/specs/wrapper-array/isVisible.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describeWithShallowAndMount } from '~resources/utils'
22
import { compileToFunctions } from 'vue-template-compiler'
3-
import '~vue/test-utils'
3+
import '@vue/test-utils'
44

55
describeWithShallowAndMount('isVisible', mountingMethod => {
66
it('returns true if node has no inline style', () => {

test/specs/wrapper-array/name.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describeWithShallowAndMount } from '~resources/utils'
22
import { compileToFunctions } from 'vue-template-compiler'
3-
import '~vue/test-utils'
3+
import '@vue/test-utils'
44

55
describeWithShallowAndMount('name', mountingMethod => {
66
it('throws an error when called on a WrapperArray', () => {

test/specs/wrapper-array/props.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describeWithShallowAndMount } from '~resources/utils'
22
import { compileToFunctions } from 'vue-template-compiler'
3-
import '~vue/test-utils'
3+
import '@vue/test-utils'
44

55
describeWithShallowAndMount('props', mountingMethod => {
66
it('throws error if wrapper array contains no items', () => {

test/specs/wrapper-array/text.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describeWithShallowAndMount } from '~resources/utils'
22
import { compileToFunctions } from 'vue-template-compiler'
3-
import '~vue/test-utils'
3+
import '@vue/test-utils'
44

55
describeWithShallowAndMount('text', mountingMethod => {
66
it('throws error when called on a WrapperArray', () => {

test/specs/wrapper/emitted.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { createLocalVue, createWrapper } from '~vue/test-utils'
1+
import { createLocalVue, createWrapper } from '@vue/test-utils'
22
import { describeWithShallowAndMount, vueVersion } from '~resources/utils'
33
import { itDoNotRunIf } from 'conditional-specs'
44
import Vue from 'vue'

test/specs/wrapper/find.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { compileToFunctions } from 'vue-template-compiler'
2-
import { createLocalVue } from '~vue/test-utils'
2+
import { createLocalVue } from '@vue/test-utils'
33
import Vue from 'vue'
44
import ComponentWithChild from '~resources/components/component-with-child.vue'
55
import ComponentWithoutName from '~resources/components/component-without-name.vue'

0 commit comments

Comments
 (0)