Socket
Socket
Sign inDemoInstall

@testing-library/vue

Package Overview
Dependencies
Maintainers
15
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@testing-library/vue

Simple and complete Vue DOM testing utilities that encourage good testing practices.


Version published
Weekly downloads
279K
increased by4.82%
Maintainers
15
Weekly downloads
 
Created

What is @testing-library/vue?

@testing-library/vue is a lightweight solution for testing Vue.js components. It provides utilities to render Vue components and interact with them in a way that resembles how users would interact with your application. This helps ensure that your tests are more reliable and maintainable.

What are @testing-library/vue's main functionalities?

Rendering Components

This feature allows you to render Vue components in a test environment. The `render` function returns utility functions to query the rendered component.

const { render } = require('@testing-library/vue');
const MyComponent = require('./MyComponent.vue');

const { getByText } = render(MyComponent);
getByText('Hello World');

Firing Events

This feature allows you to simulate user interactions with your components. The `fireEvent` utility can be used to trigger events like clicks, input changes, etc.

const { render, fireEvent } = require('@testing-library/vue');
const MyComponent = require('./MyComponent.vue');

const { getByText } = render(MyComponent);
const button = getByText('Click me');
fireEvent.click(button);

Querying Elements

This feature provides various query utilities to find elements in the rendered component. You can query by text, role, placeholder text, etc.

const { render } = require('@testing-library/vue');
const MyComponent = require('./MyComponent.vue');

const { getByText, getByRole } = render(MyComponent);
const button = getByRole('button');
const text = getByText('Hello World');

Other packages similar to @testing-library/vue

Keywords

FAQs

Package last updated on 31 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc