question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rename shallow to shallowMount

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
lmiller1990commented, Apr 15, 2018

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.

1reaction
FernandoBassocommented, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

shallowMount() - Vue Test Utils
# shallowMount() ... Like mount , it creates a Wrapper that contains the mounted and rendered Vue component, but with stubbed child components....
Read more >
Five Traps to Avoid While Unit Testing Vue.js
Shallow will only render your specific component and not child components. It makes your tests more robust, as you are only focusing on...
Read more >
Knowing What To Test - Vue Component Unit Testing
In it, we'll shallow mount our components with Vue Test Utils, ... But hang on, what if someone accidentally renames title to name...
Read more >
Why I Never Use Shallow Rendering - Kent C. Dodds
My test continues to work, but my component is broken. I could rename toggle to handleButtonClick (and update the corresponding onClickĀ ...
Read more >
Unit Testing with Vue-test-utils - Section.io
In our project directory, we will rename the ... Import the shallowMount function from the vue-test-utils library and the component to test,Ā ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found