Skip to content

Commit fb7a66c

Browse files
authored
feat: do not stub unregistered components (#1048)
1 parent 89f4ffc commit fb7a66c

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

Diff for: packages/create-instance/patch-render.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,11 @@ export function patchRender (_Vue, stubs, stubAllComponents) {
8787
if (typeof el === 'string') {
8888
let original = resolveComponent(el, originalComponents)
8989

90+
if (!original) {
91+
return originalCreateElement(el, ...args)
92+
}
93+
9094
if (
91-
original &&
9295
original.options &&
9396
original.options.$_vueTestUtils_original
9497
) {

Diff for: test/specs/shallow-mount.spec.js

+12-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import ComponentWithoutName from '~resources/components/component-without-name.v
99
import ComponentAsAClassWithChild from '~resources/components/component-as-a-class-with-child.vue'
1010
import RecursiveComponent from '~resources/components/recursive-component.vue'
1111
import { vueVersion } from '~resources/utils'
12-
import { describeRunIf, itDoNotRunIf, itSkipIf } from 'conditional-specs'
12+
import { describeRunIf, itDoNotRunIf } from 'conditional-specs'
1313

1414
describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
1515
beforeEach(() => {
@@ -379,8 +379,17 @@ describeRunIf(process.env.TEST_ENV !== 'node', 'shallowMount', () => {
379379
.to.equal('hey')
380380
})
381381

382-
itSkipIf(
383-
typeof Proxy === 'undefined',
382+
it('does not stub unregistered components', () => {
383+
const TestComponent = {
384+
template: '<custom-element />'
385+
}
386+
const wrapper = shallowMount(TestComponent)
387+
388+
expect(wrapper.html())
389+
.to.equal('<custom-element></custom-element>')
390+
})
391+
392+
it(
384393
'stubs lazily registered components', () => {
385394
const Child = {
386395
render: h => h('p')

0 commit comments

Comments
 (0)