@vuetify/testing-library-dom

Simple and complete DOM testing utilities that encourage good testing practices.
15,432
Install
npm install @vuetify/testing-library-dom
Latest Version:1.0.3
License:MIT
Last Updated:Nov 27, 2025
Links: GitHub  ·  npm
Maintainer: johnjleider

Read the docs | Edit the docs

[![Build Status][build-badge]][build] [![Code Coverage][coverage-badge]][coverage] [![version][version-badge]][package] [![downloads][downloads-badge]][npmtrends] [![MIT License][license-badge]][license] ![All Contributors][all-contributors-badge] [![PRs Welcome][prs-badge]][prs] [![Code of Conduct][coc-badge]][coc] [![Discord][discord-badge]][discord]

[![Watch on GitHub][github-watch-badge]][github-watch] [![Star on GitHub][github-star-badge]][github-star] [![Tweet][twitter-badge]][twitter]

Table of Contents

The Problem

You want to write maintainable tests for your Web UI. As a part of this goal, you want your tests to avoid including implementation details of your components and rather focus on making your tests give you the confidence for which they are intended. As part of this, you want your testbase to be maintainable in the long run so refactors of your components (changes to implementation but not functionality) don't break your tests and slow you and your team down.

This Solution

The DOM Testing Library is a very light-weight solution for testing DOM nodes (whether simulated with JSDOM as provided by default with [Jest][] or in the browser). The main utilities it provides involve querying the DOM for nodes in a way that's similar to how the user finds elements on the page. In this way, the library helps ensure your tests give you confidence in your UI code. The DOM Testing Library's primary guiding principle is:

[The more your tests resemble the way your software is used, the more confidence they can give you.][guiding-principle]

Installation

This module is distributed via [npm][npm] which is bundled with [node][node] and should be installed as one of your project's devDependencies:

npm install --save-dev @testing-library/dom

Docs

Documentation

Read the docs (and discover framework and tool-specific implementations) at testing-library.com

Guiding Principles

[The more your tests resemble the way your software is used, the more confidence they can give you.][guiding-principle]

We try to only expose methods and utilities that encourage you to write tests that closely resemble how your web pages are used.

Utilities are included in this project based on the following guiding principles:

  1. If it relates to rendering components, it deals with DOM nodes rather than component instances, nor should it encourage dealing with component instances.
  2. It should be generally useful for testing the application components in the way the user would use it. We are making some trade-offs here because we're using a computer and often a simulated browser environment, but in general, utilities should encourage tests that use the components the way they're intended to be used.
  3. Utility implementations and APIs should be simple and flexible.

At the end of the day, what we want is for this library to be pretty light-weight, simple, and understandable.

Contributors

Thanks goes to these people ([emoji key][emojis]):

Related Packages

@atomic-testing/vue-3

The @atomic-testing/vue-3 package is a Vue 3 test adapter that extends Atomic Te...

4,609 5
@serenity-js/protractor

Adapter that integrates @serenity-js/web with Protractor, enabling Serenity/JS r...

181,546 619
vue-unit-helper

Helpers for unit testing Vue components

1,301 0
warpdom

A fast DOM for unit and component tests: jsdom's test results, faster. A drop-in...

0 4
nightwatch

Easy to use Node.js based end-to-end testing solution for web applications using...

6,489,162 11,951

Version History

Version Released License
1.0.3 MIT
1.0.2 MIT
1.0.1 MIT
1.0.0 MIT