Vitest Reporter
Send your Vitest test results directly to TestPig.io! Our Vitest reporter seamlessly delivers your test results to your dashboard, giving you powerful insights with minimal setup.
Vitest + TestPig.io = Supercharged test reporting!
Quick Installation ⚡
npm install @testpig/vitest-reporter --save-dev
Configuration 🛠️
Step 1: Add the Reporter to Your Configuration File (Required)
First, add the TestPig.io reporter to your Vitest configuration in vite.config.js or vitest.config.js:
export default {
test: {
reporters: [
'default',
'@testpig/vitest-reporter'
]
}
}
Step 2: Point Reporter to TestPig
Method 1: Environment Variables (Recommended 👍)
Set these environment variables for maximum flexibility:
export TESTPIG_PROJECT_ID=your-project-id
export TESTPIG_RUN_ID=your-run-id # Optional
export TESTPIG_API_KEY=your-api-key
Your Vitest config remains clean with just the reporter definition as shown above.
Method 2: Configuration File Options
Alternatively, specify credentials directly in your configuration file:
export default {
test: {
reporters: [
'default',
['@testpig/vitest-reporter', {
projectId: 'your-project-id',
runId: 'your-run-id', // Optional
apiKey: 'your-api-key'
}]
]
}
}
Using It Is a Breeze 🌬️
Run your tests exactly like you normally would:
npm test
# or if you prefer
npx vitest
That's it! Your results will magically appear in your TestPig.io dashboard.
Awesome Features You'll Love ❤️
- Comprehensive Reporting: Every detail of your tests, beautifully organized
- Smart Organization: Test suites displayed in an intuitive hierarchy
- Performance Tracking: See exactly how long each test takes to run
- Failure Forensics: Detailed error reporting to pinpoint issues
- Coverage Insights: Track your code coverage alongside test results
Configuration Options At-a-Glance 📋
| Option | What It Does | Required? |
|---|---|---|
| projectId | Links results to your TestPig.io project | ✅ Yes |
| runId | Groups tests under a single run identifier | ❌ No |
| apiKey | Your secure access key to TestPig.io | ✅ Yes |
Check our Best Practices guide for advanced configuration strategies.
Docker Usage 🐳
Running Vitest tests in Docker? TestPig makes it seamless with automatic git detection:
# Simple Docker usage with proper git info
docker run --rm $(npx testpig-git-env) my-vitest-image
The testpig-git-env utility automatically detects your CI environment and provides proper git information to Docker containers.
For comprehensive Docker setup, CI/CD examples, and troubleshooting, see our Docker Usage Guide.
Getting Help
If you encounter issues with the Vitest reporter:
- Check the Vitest Reporter GitHub repository for reporter-specific code issues
- Visit support.testpig.io for all bugs, feature requests, account or technical issues