Useful Testing Tips

Look at useful tips that will help us write cleaner and more maintainable tests.

We'll cover the following

Let’s discuss the testing tips:

  • If a component relies on fetching data from an API or determines if some HTML markup should be rendered conditionally in the mounted hook, ensure you correctly await it in your tests. You might need to wait for the nextTick to ensure that Vue flushed all updates and patched the DOM. In the first version of Vue Test Utils, you need to wait for nextTick explicitly, and the second one might already do it for you, so check the docs.

Get hands-on with 1200+ tech skills courses.