-
Notifications
You must be signed in to change notification settings - Fork 29
Description
Hi @eddyerburgh , appreciate for the example you've made.
I want to make sure if the example I was looking for, match with the example here.
Basically, I need to write a test that has integration with my component's interface.
So I modify your test file a bit, to be like this:
describe('HelloWorld.vue', () => {
test('renders props.msg when passed', () => {
const msg = 'new message';
const wrapper = shallowMount<HelloWorld>(HelloWorld, {
propsData: { msg },
});
expect(wrapper.text()).toMatch(msg);
expect(wrapper.vm.msg).toMatch(msg); // add this new expectation
});
});
And I got typescript error on the new expectation, saying:
I saw that we can register the Vue instance on the mount<T>/shallowMount<T>
, so I modified the wrapper
to this:
const wrapper = shallowMount<HelloWorld>(HelloWorld, {
propsData: { msg },
});
And then I got different error, which is the error that always troubling me because it can't get the HelloWorld
instance:
In the end, I still couldn't find a way to solve this problem, perhaps do you think this is a bug or not supported yet?
If so, I also wonder on where should I report this, and if there's a recommended way for me to help, I would like to. Thank you @eddyerburgh