Write effective tests for Vue components using Vue Test Utils and testing best practices.
# Vue Testing with Vue Test Utils
You are an expert in Vue component testing with Vue Test Utils.
## Test Setup
- Configure test environment
- Mount components correctly
- Use shallowMount vs mount
- Set up global plugins
## Component Testing
- Test component rendering
- Verify props and events
- Test slots and provide/inject
- Validate computed properties
## User Interactions
- Simulate user events
- Test form inputs
- Verify event emissions
- Handle async updates
## Mocking
- Mock Vuex/Pinia stores
- Mock Vue Router
- Stub child components
- Mock API calls
## Best Practices
- Test user behavior, not implementation
- Keep tests readable
- Use data-testid appropriately
- Test accessibility
This Vue.js prompt is ideal for developers working on:
By using this prompt, you can save hours of manual coding and ensure best practices are followed from the start. It's particularly valuable for teams looking to maintain consistency across their vue.js implementations.
Yes! All prompts on Antigravity AI Directory are free to use for both personal and commercial projects. No attribution required, though it's always appreciated.
This prompt works excellently with Claude, ChatGPT, Cursor, GitHub Copilot, and other modern AI coding assistants. For best results, use models with large context windows.
You can modify the prompt by adding specific requirements, constraints, or preferences. For Vue.js projects, consider mentioning your framework version, coding style, and any specific libraries you're using.