Logo

Tag: testing

How to Configure Jest for Vue apps Using Vuetify

October 9, 2019
abstract-pink-blue-connections
I have recently been working on a Vue project which utilizes Vuetify for the base of some of it's components. Vue has the ability to register components globally, eliminating the need for importing base components. This works great in development, but I came across an error when testing the component with Vue Testing Library. Vue console error for using a globally registered component that could not be found This error occurred because Jest had not been configured to recognize Vuetify's global components. In order to resolve this, some additional information was required in the Jest setup file. First, we need to import both Vue and Vuetify in the setup file. By calling , Jest becomes aware of the plugin and the globally available components…
Read More

8 New ESLint Rules - Jest

September 9, 2019
markus-spiske-stacked-stones
Maintaining an ESLint config has several benefits, a significant one being seeing new rules as they become available. ESLint shapes the way we use JavaScript, and now TypeScript too. As I prepared for the latest release of my own ESLint config, I became aware of several new and helpful rules for testing with Jest. In this post, I'll dive into what some of these new rules are and some considerations for why they aren't added to the options. The interesting balance of ESLint semver ESLint rules are an interesting interplay with semantic versioning or semver. Adding a new rule as an option is considered a feature and warrants bumping the package a minor version. However, enabling the rule as an error can cause new lint errors. This is…
Read More

How to Manage Snapshots with ESLint

March 18, 2019
Individual holding a camera lens with mountains and lake in the distance
Jest Snapshots can be a valuable utility for monitoring code changes for UI components. They can also become a scourge if they become too large. The line between the two isn't always clear. Snapshots don't offer a clear mechanism to determining how large they are. This makes it easy to create large snapshots that are hard to diff. The likelihood of a thorough review on a snapshot diff decreases in relation to the size of the snapshot. I have both observed and committed broken snapshot updates into repositories as part of a branch. The danger lies in making intentional changes to a particular feature and updating the snapshot without checking for other breakages. If the snapshot diff is large, it will likely not receive as thorough a review…
Read More
2022 Skyler Lemay. All Rights Reserved.