Skip to content

Mounting Option stubs not working. #713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cpxPratik opened this issue Jun 14, 2018 · 7 comments
Closed

Mounting Option stubs not working. #713

cpxPratik opened this issue Jun 14, 2018 · 7 comments
Labels

Comments

@cpxPratik
Copy link
Contributor

Version

1.0.0-beta.18

Reproduction link

https://jsfiddle.net/cpxPratik/sa3yqznw/3/

Steps to reproduce

When shallowmounting or mounting, giving stubs mounting option such as stubs: ['router-link'].

What is expected?

Should not have any warning.

What is actually happening?

Warning on console: [Vue warn]: Unknown custom element: <router-link-stub> - did you register the component correctly? For recursive components, make sure to provide the "name" option.


Doing VueTestUtils.config.stubs['router-link'] = '<div />' solves it, but mounting option should have worked too unless i am misunderstanding sth. Warning was produced after updating from 1.0.0-beta.14 to 1.0.0-beta.16, there was not warning beforehand.

@eddyerburgh
Copy link
Member

eddyerburgh commented Jun 14, 2018

Thanks for the bug report.

A temporary fix is to add it to the ignored elements:

import Vue from 'vue'

Vue.config.ignoredElements.push('router-link-stub')

@sreuss
Copy link

sreuss commented Jun 14, 2018

Could the mocks option be affected as well? Just tried to upgrade from beta.17 to beta.18 and I am seeing some strange test failures.

@eddyerburgh
Copy link
Member

That's a seperate issue that's been fixed in #709. I'll release this evening 👍

@cars10
Copy link

cars10 commented Jun 22, 2018

I still experience the same behaviour in beta.19.

@eddyerburgh
Copy link
Member

Can you create an issue with a reproduction?

@lambdalisue
Copy link

@eddyerburgh @cars10

The following codes BEFORE tests fixed the behavior in my environment with beta.20.

import Vue from 'vue';

Vue.config.ignoreElements = [];

It seems Vue.config.ignoreElements must be assigned prior to the test?
https://github.com/vuejs/vue-test-utils/pull/714/files#diff-814c51828b90615b0a6800b1ecd862ecR67

@eddyerburgh
Copy link
Member

Can you check if setting it in mount.js fixes the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants