{"id":13464931,"url":"https://github.com/testing-library/vue-testing-library","last_synced_at":"2025-05-13T23:09:47.454Z","repository":{"id":37692699,"uuid":"126239632","full_name":"testing-library/vue-testing-library","owner":"testing-library","description":"🦎 Simple and complete Vue.js testing utilities that encourage good testing practices.","archived":false,"fork":false,"pushed_at":"2024-05-29T12:56:23.000Z","size":1840,"stargazers_count":1101,"open_issues_count":32,"forks_count":112,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-05-09T11:50:40.446Z","etag":null,"topics":["dom-testing-library","test","testing","testing-tools","vue","vue-testing-library","vuejs"],"latest_commit_sha":null,"homepage":"http://testing-library.com/vue","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/testing-library.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-21T20:56:10.000Z","updated_at":"2025-05-03T12:22:58.000Z","dependencies_parsed_at":"2022-07-09T04:17:03.098Z","dependency_job_id":"080b82be-4c9f-4ab7-96c9-39041e298944","html_url":"https://github.com/testing-library/vue-testing-library","commit_stats":{"total_commits":341,"total_committers":55,"mean_commits":6.2,"dds":0.624633431085044,"last_synced_commit":"d46ed8f757e77fe85b369847c21d394bb9706066"},"previous_names":[],"tags_count":63,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testing-library%2Fvue-testing-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testing-library%2Fvue-testing-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testing-library%2Fvue-testing-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/testing-library%2Fvue-testing-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/testing-library","download_url":"https://codeload.github.com/testing-library/vue-testing-library/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253505664,"owners_count":21918942,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dom-testing-library","test","testing","testing-tools","vue","vue-testing-library","vuejs"],"created_at":"2024-07-31T14:00:52.987Z","updated_at":"2025-05-13T23:09:47.403Z","avatar_url":"https://github.com/testing-library.png","language":"JavaScript","readme":"\u003cdiv align=\"center\"\u003e\n\u003ch1\u003eVue Testing Library\u003c/h1\u003e\n\n\u003cbr /\u003e\n\n\u003ca href=\"https://www.joypixels.com/emoji/1F98E\"\u003e\n  \u003cimg\n    height=\"80\"\n    width=\"80\"\n    alt=\"lizard\"\n    src=\"https://raw.githubusercontent.com/testing-library/vue-testing-library/main/lizard.png\"\n  /\u003e\n\u003c/a\u003e\n\n\u003cp\u003eSimple and complete Vue.js testing utilities that encourage good testing practices.\u003c/p\u003e\n\n\u003cp\u003eVue Testing Library is a lightweight adapter built on top of \u003ca href=\"https://github.com/testing-library/dom-testing-library/\"\u003eDOM Testing Library\u003c/a\u003e and \u003ca href=\"https://github.com/vuejs/vue-test-utils\"\u003e@vue/test-utils\u003c/a\u003e.\u003c/p\u003e\n\n\u003cbr /\u003e\n\n[**Read the docs**][docs] | [Edit the docs][docs-edit]\n\n\u003cbr /\u003e\n\n\u003c/div\u003e\n\n\u003chr /\u003e\n\n\u003c!-- prettier-ignore-start --\u003e\n[![Coverage Status][coverage-badge]][coverage]\n[![GitHub version][github-badge]][github]\n[![npm version][npm-badge]][npm]\n[![Discord][discord-badge]][discord]\n[![MIT License][license-badge]][license]\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003ch2\u003eTable of Contents\u003c/h2\u003e\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n\n- [Installation](#installation)\n- [A basic example](#a-basic-example)\n  - [More examples](#more-examples)\n- [Guiding Principles](#guiding-principles)\n- [Docs](#docs)\n- [Typings](#typings)\n- [ESLint support](#eslint-support)\n- [Issues](#issues)\n  - [🐛 Bugs](#-bugs)\n  - [💡 Feature Requests](#-feature-requests)\n  - [❓ Questions](#-questions)\n- [License](#license)\n- [Contributors](#contributors)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Installation\n\nThis module is distributed via `npm` and should be installed as one of your\nproject's `devDependencies`:\n\n```\nnpm install --save-dev @testing-library/vue\n```\n\nThis library has `peerDependencies` listings for `Vue 3` and\n`@vue/compiler-sfc`.\n\nYou may also be interested in installing `jest-dom` so you can use [the custom\nJest matchers][jest-dom].\n\nIf you're using Vue 2, please install version 5 of the library:\n\n```\nnpm install --save-dev @testing-library/vue@^5\n```\n\n\n## A basic example\n\n```html\n\u003ctemplate\u003e\n  \u003cp\u003eTimes clicked: {{ count }}\u003c/p\u003e\n  \u003cbutton @click=\"increment\"\u003eincrement\u003c/button\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\n  export default {\n    name: 'Button',\n    data: () =\u003e ({\n      count: 0,\n    }),\n    methods: {\n      increment() {\n        this.count++\n      },\n    },\n  }\n\u003c/script\u003e\n```\n\n```js\nimport {render, screen, fireEvent} from '@testing-library/vue'\nimport Button from './Button'\n\ntest('increments value on click', async () =\u003e {\n  // The `render` method renders the component into the document.\n  // It also binds to `screen` all the available queries to interact with\n  // the component.\n  render(Button)\n\n  // queryByText returns the first matching node for the provided text\n  // or returns null.\n  expect(screen.queryByText('Times clicked: 0')).toBeTruthy()\n\n  // getByText returns the first matching node for the provided text\n  // or throws an error.\n  const button = screen.getByText('increment')\n\n  // Click a couple of times.\n  await fireEvent.click(button)\n  await fireEvent.click(button)\n\n  expect(screen.queryByText('Times clicked: 2')).toBeTruthy()\n})\n```\n\n\u003e You might want to install [`jest-dom`][jest-dom] to add handy assertions such\n\u003e as `.toBeInTheDocument()`. In the example above, you could write\n\u003e `expect(screen.getByText('Times clicked: 0')).toBeInTheDocument()`.\n\n\u003e Using `byText` queries it's not the only nor the best way to query for\n\u003e elements. Read [Which query should I use?][which-query] to discover\n\u003e alternatives. In the example above, `getByRole('button', {name: 'increment'})`\n\u003e is possibly the best option to get the button element.\n\n### More examples\n\nYou'll find examples of testing with different situations and popular libraries\nin [the test directory][test-directory].\n\nSome included are:\n\n- [`vuex`][vuex-example]\n- [`vue-router`][vue-router-example]\n- [`vee-validate`][vee-validate-example]\n- [`vue-i18n`][vue-i18n-example]\n- [`vuetify`][vuetify-example]\n\nFeel free to contribute with more examples!\n\n## Guiding Principles\n\n\u003e [The more your tests resemble the way your software is used, the more\n\u003e confidence they can give you.][guiding-principle]\n\nWe try to only expose methods and utilities that encourage you to write tests\nthat closely resemble how your Vue components are used.\n\nUtilities are included in this project based on the following guiding\nprinciples:\n\n1.  If it relates to rendering components, it deals with DOM nodes rather than\n    component instances, nor should it encourage dealing with component\n    instances.\n2.  It should be generally useful for testing individual Vue components or full\n    Vue applications.\n3.  Utility implementations and APIs should be simple and flexible.\n\nAt the end of the day, what we want is for this library to be pretty\nlight-weight, simple, and understandable.\n\n## Docs\n\n[**Read the docs**][docs] | [Edit the docs][docs-edit]\n\n## Typings\n\n_Please note that TypeScript 4.X is required._\n\nThe TypeScript type definitions are in the [types][types-directory] directory.\n\n## ESLint support\n\nIf you want to lint test files that use Vue Testing Library, you can use the\nofficial plugin: [eslint-plugin-testing-library][eslint-plugin-testing-library].\n\n## Issues\n\n_Looking to contribute? Look for the [Good First Issue][good-first-issue]\nlabel._\n\n### 🐛 Bugs\n\nPlease [file an issue][add-issue-bug] for bugs, missing documentation, or\nunexpected behavior.\n\n[**See Bugs**][bugs]\n\n### 💡 Feature Requests\n\nPlease [file an issue][add-issue] to suggest new features. Vote on feature\nrequests by adding a 👍. This helps maintainers prioritize what to work on.\n\n### ❓ Questions\n\nFor questions related to using the library, please visit a support community\ninstead of filing an issue on GitHub.\n\n- [Discord][discord]\n\n## License\n\n[MIT][license]\n\n## Contributors\n\n[![dfcook](https://avatars0.githubusercontent.com/u/10348212?v=3\u0026s=120)](https://github.com/dfcook)\n[![afontcu](https://avatars3.githubusercontent.com/u/9197791?v=3\u0026s=120)](https://github.com/afontcu)\n[![eunjae-lee](https://avatars0.githubusercontent.com/u/499898?v=3\u0026s=120)](https://github.com/eunjae-lee)\n[![tim-maguire](https://avatars0.githubusercontent.com/u/29452317?v=3\u0026s=120)](https://github.com/tim-maguire)\n[![samdelacruz](https://avatars0.githubusercontent.com/u/2040007?v=3\u0026s=120)](https://github.com/samdelacruz)\n[![ankitsinghaniyaz](https://avatars0.githubusercontent.com/u/11331989?v=3\u0026s=120)](https://github.com/ankitsinghaniyaz)\n[![lindgr3n](https://avatars0.githubusercontent.com/u/24882614?v=3\u0026s=120)](https://github.com/lindgr3n)\n[![kentcdodds](https://avatars0.githubusercontent.com/u/1500684?v=3\u0026s=120)](https://github.com/kentcdodds)\n[![brennj](https://avatars2.githubusercontent.com/u/29227924?v=3\u0026s=120)](https://github.com/brennj)\n[![makeupsomething](https://avatars2.githubusercontent.com/u/7676733?v=3\u0026s=120)](https://github.com/makeupsomething)\n[![mb200](https://avatars2.githubusercontent.com/u/22549525?v=3\u0026s=120)](https://github.com/mb200)\n[![Oluwasetemi](https://avatars2.githubusercontent.com/u/10030028?v=3\u0026s=120)](https://github.com/Oluwasetemi)\n[![cimbul](https://avatars2.githubusercontent.com/u/927923?v=3\u0026s=120)](https://github.com/cimbul)\n[![alexkrolick](https://avatars2.githubusercontent.com/u/1571667?v=3\u0026s=120)](https://github.com/alexkrolick)\n[![edufarre](https://avatars2.githubusercontent.com/u/25011566?v=3\u0026s=120)](https://github.com/edufarre)\n[![SandraDml](https://avatars2.githubusercontent.com/u/5694169?v=3\u0026s=120)](https://github.com/SandraDml)\n[![arnaublanche](https://avatars2.githubusercontent.com/u/24812315?v=3\u0026s=120)](https://github.com/arnaublanche)\n[![NoelDeMartin](https://avatars2.githubusercontent.com/u/1517677?v=3\u0026s=120)](https://github.com/NoelDeMartin)\n[![chiptus](https://avatars2.githubusercontent.com/u/1381655?v=3\u0026s=120)](https://github.com/chiptus)\n[![bennettdams](https://avatars2.githubusercontent.com/u/29319414?v=3\u0026s=120)](https://github.com/bennettdams)\n[![mediafreakch](https://avatars2.githubusercontent.com/u/777093?v=3\u0026s=120)](https://github.com/mediafreakch)\n[![afenton90](https://avatars2.githubusercontent.com/u/8963736?v=3\u0026s=120)](https://github.com/afenton90)\n[![cilice](https://avatars2.githubusercontent.com/u/835588?v=3\u0026s=120)](https://github.com/cilice)\n[![ITenthusiasm](https://avatars2.githubusercontent.com/u/47364027?v3\u0026s=120)](https://github.com/ITenthusiasm)\n\n\u003c!-- prettier-ignore-start --\u003e\n[coverage-badge]: https://img.shields.io/codecov/c/github/testing-library/vue-testing-library.svg\n[coverage]: https://codecov.io/github/testing-library/vue-testing-library\n[github-badge]: https://badge.fury.io/gh/testing-library%2Fvue-testing-library.svg\n[github]: https://badge.fury.io/gh/testing-library%2Fvue-testing-library\n[npm-badge]: https://badge.fury.io/js/%40testing-library%2Fvue.svg\n[npm]: https://badge.fury.io/js/%40testing-library%2Fvue\n[license-badge]: https://img.shields.io/github/license/testing-library/vue-testing-library.svg\n[license]: https://github.com/testing-library/vue-testing-library/blob/master/LICENSE\n[discord]: https://testing-library.com/discord\n[discord-badge]: https://img.shields.io/discord/723559267868737556.svg?label=\u0026logo=discord\u0026logoColor=ffffff\u0026color=7389D8\u0026labelColor=6A7EC2\u0026style=flat-square\n[jest-dom]: https://github.com/testing-library/jest-dom\n[which-query]: https://testing-library.com/docs/guide-which-query\n[guiding-principle]: https://twitter.com/kentcdodds/status/977018512689455106\n[good-first-issue]: https://github.com/testing-library/vue-testing-library/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22\n\n[docs]: https://testing-library.com/vue\n[docs-edit]: https://github.com/testing-library/testing-library-docs\n[eslint-plugin-testing-library]: https://github.com/testing-library/eslint-plugin-testing-library\n\n[bugs]: https://github.com/testing-library/vue-testing-library/issues?q=is%3Aissue+is%3Aopen+label%3Abug+sort%3Acreated-desc\n[add-issue-bug]: https://github.com/testing-library/vue-testing-library/issues/new?assignees=\u0026labels=bug\u0026template=bug_report.md\u0026title=\n[add-issue]: (https://github.com/testing-library/vue-testing-library/issues/new)\n\n[types-directory]: https://github.com/testing-library/vue-testing-library/blob/main/types\n[test-directory]: https://github.com/testing-library/vue-testing-library/blob/main/src/__tests__\n[vuex-example]: https://github.com/testing-library/vue-testing-library/blob/main/src/__tests__/vuex.js\n[vue-router-example]: https://github.com/testing-library/vue-testing-library/blob/main/src/__tests__/vue-router.js\n[vee-validate-example]: https://github.com/testing-library/vue-testing-library/blob/main/src/__tests__/validate-plugin.js\n[vue-i18n-example]: https://github.com/testing-library/vue-testing-library/blob/main/src/__tests__/translations-vue-i18n.js\n[vuetify-example]: https://github.com/testing-library/vue-testing-library/blob/main/src/__tests__/vuetify.js\n\u003c!-- prettier-ignore-end --\u003e\n","funding_links":[],"categories":["JavaScript","Components \u0026 Libraries","vuejs","Dev Tools","Dev Tools [🔝](#readme)"],"sub_categories":["Dev Tools","Test"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftesting-library%2Fvue-testing-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftesting-library%2Fvue-testing-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftesting-library%2Fvue-testing-library/lists"}