Skip to content

Commit ecd23af

Browse files
committed
fix: handle extended components
1 parent e0115fd commit ecd23af

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

packages/create-instance/patch-create-element.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ function shouldExtend (component, _Vue) {
1818
}
1919

2020
function extend (component, _Vue) {
21-
const stub = _Vue.extend(component.options)
21+
const componentOptions = component.options ? component.options : component
22+
const stub = _Vue.extend(componentOptions)
2223
stub.options.$_vueTestUtils_original = component
2324
return stub
2425
}
@@ -92,17 +93,16 @@ export function patchCreateElement (_Vue, stubs, stubAllComponents) {
9293
return originalCreateElement(el, ...args)
9394
}
9495

96+
if (isDynamicComponent(original)) {
97+
return originalCreateElement(el, ...args)
98+
}
99+
95100
if (
96101
original.options &&
97102
original.options.$_vueTestUtils_original
98103
) {
99104
original = original.options.$_vueTestUtils_original
100105
}
101-
102-
if (isDynamicComponent(original)) {
103-
return originalCreateElement(el, ...args)
104-
}
105-
106106
const stub = createStubIfNeeded(stubAllComponents, original, _Vue, el)
107107

108108
if (stub) {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default function renderToString (
3737
// $FlowIgnore
3838
renderer.renderToString(vm, (err, res) => {
3939
if (err) {
40-
console.log(err)
40+
throw err
4141
}
4242
renderedString = res
4343
})

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

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ describeWithMountingMethods('options.localVue', mountingMethod => {
9292
localVue.prototype.$route = {}
9393

9494
const Extends = {
95+
template: '<div />',
9596
created () {
9697
console.log(this.$route.params)
9798
}

0 commit comments

Comments
 (0)