Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename shallow to shallowMount #525

Closed
chrisvfritz opened this issue Apr 11, 2018 · 6 comments
Closed

Rename shallow to shallowMount #525

chrisvfritz opened this issue Apr 11, 2018 · 6 comments

Comments

@chrisvfritz
Copy link
Contributor

As discussed with @eddyerburgh, I've had to explain to a lot of people that shallow does actually mount, it's just a shallow mount. 馃槃 This rename would make that clearer.

@eddyerburgh
Copy link
Member

I prefer shallow because it's more terse, but I'm used to the enzyme API which has a shallow method.

It seems a lot of people are confused by shallow, so I'm in favor of renaming the method to shallowMount

@lmiller1990
Copy link
Member

Another potentially less confusing alternative could be a shallow option:

const wrapper = mount(Component, {
  shallow: true
})

Although I don't have a strong opinion either way.

@FernandoBasso
Copy link

FernandoBasso commented Apr 15, 2018

Since VTU is about unit testing, and that more or less means one does not mount/test child components, what about mount defaulting to "shallow" and then allowing the user set it to true when they need, like @lmiller1990's approach?

I understand that perhaps people would complain "hey, my components do not get properly mounted" if they don't see child components mounted as well and didn't read the docs about shallow/non-shallow.

Anyway, that is another idea that may or may not work.

@chrisvfritz
Copy link
Contributor Author

I think the shallow option could be OK, except it's such a big change in behavior that I'd worry it could get lost with other options.

@eddyerburgh
Copy link
Member

My preference is to rename shallow to shallowMount

@lmiller1990
Copy link
Member

It's easy enough to set up an alias from for people who prefer shallow, so I'm okay with this.

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

No branches or pull requests

4 participants