VoV 023: Unit Testing Vue components with Edd Yerburgh
- Divya Sasidharan
- Chris Fritz
- Joe Eames
Special Guests: Edd Yerburgh
In this episode, the Views on Vue panel talks to Edd Yerburgh about unit testing Vue components. Edd is a software engineer for BBC in London and he maintains Vue Test Utils, which is a library to help make unit testing Vue components easier.
Edd talks about some of the good patterns to use with Vue unit testing. He also describes what you should test or whether you should write the unit test in the first place.
The unit testing written also acts as code documentation where a developer reviewing the tests will get an idea of how the code is expected to behave and what the edge cases are.
They talk about how you would use Vue Test Utils, examples of components you would test with Vue Test Utils, and good patterns to use when testing. They also touch on snapshot testing, the Vue Jest library, and more!
In particular, we dive pretty deep on:
- Edd intro
- Maintains Vue Test Utils
- What is Vue Test Utils?
- Library to make unit testing Vue components easier
- What is a mounted component?
- Would you use Vue Test Utils by yourself?
- Jest, Jasmine, and Mocha
- Needs to be run in a DOM environment
- JS DOM
- Examples of components that you would use to test with Vue Test Utils
- What are good patterns to use when testing?
- Consider what and if you should test?
- Difficult to give a definitive answer as to when you should unit test vs you shouldn’t
- What you hope when you are writing unit tests
- Tests as a form of documentation
- Writing unit tests to pay off in the future
- What is a Snapshot test?
- When would you use a snapshot test?
- Leaning on Jest for snapshot tests
- Vue Jest library
- Testing in Vue
- Creating components within your test itself
- Testing a mixin
- And much, much more!
- Vue Test Utils
- Snapshot test
- Vue Jest
- Edd’s GitHub
- Edd’s Medium
- Bang Bang Con
- Moving Towards Dialogue: Collaborating with your computer using typed holes! by Vaibhav Sagar
- Having a point to stop working at night