I have a component like this
<template>
<p>{{ msg }}</p>
<inner-comp></inner-comp>
</template>
<script>
import InnerComp from './components/InnerComp .vue';
export default {
props: ['msg'],
components: {
innerComp : InnerComp
}
}
</script>
and the unit test
import Vue from 'vue'
import MyComponent from './MyComponent.vue'
// helper function that mounts and returns the rendered text
function getRenderedText (Component, propsData) {
const Ctor = Vue.extend(Component)
const vm = new Ctor({ propsData }).$mount()
return vm.$el.textContent
}
describe('MyComponent', () => {
it('renders correctly with different props', () => {
expect(getRenderedText(MyComponent, {
msg: 'Hello'
})).toBe('Hello')
})
})
Test is passing, but it is throwing LOG ERROR like this
'[Vue warn]: Failed to mount component: template or render function not defined.
(found in <InnerComp>)'