@m00nsolutions/jest-reporter
v1.0.4
Published
Jest test reporter for M00n Report dashboard - real-time test result streaming with retry support and full Jest 29+ API compatibility
Downloads
11
Maintainers
Readme
@m00nsolutions/jest-reporter
Official Jest test reporter for M00N - a real-time test reporting dashboard.
Features
- 🚀 Real-time streaming - Watch test results appear live in the dashboard
- 🔄 Retry tracking - Automatic tracking of test retries with attempt history
- 🏷️ Tags & attributes - Organize runs with custom metadata
- 🔒 Secure - API key authentication per project
- ✅ Full Jest 29+ API - Supports all reporter lifecycle hooks
Installation
npm install @m00nsolutions/jest-reporter --save-dev
# or
yarn add @m00nsolutions/jest-reporter --dev
# or
pnpm add @m00nsolutions/jest-reporter --save-devQuick Start
1. Get your API key
- Log in to M00N
- Navigate to your project settings
- Generate or copy your project API key
2. Configure Jest
Add the reporter to your jest.config.js:
module.exports = {
reporters: [
'default', // Keep default console output
['@m00nsolutions/jest-reporter', {
serverUrl: 'https://app.m00n.report', // Or your self-hosted URL
apiKey: process.env.M00N_API_KEY, // Your project API key
launch: 'Unit Tests', // Optional: run title
tags: ['unit', 'api'], // Optional: tags
attributes: { // Optional: custom metadata
environment: 'ci',
nodeVersion: process.version,
},
}],
],
};3. Run your tests
npx jestThat's it! Your test results will appear in the M00N dashboard.
Configuration Options
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| serverUrl | string | required | M00N ingest service URL |
| apiKey | string | required | Project API key (identifies org and project) |
| launch | string | 'Jest Run {date}' | Title for this test run |
| tags | string[] | [] | Tags to categorize the run |
| attributes | object | {} | Custom key-value metadata |
Environment Variables
You can also configure the reporter via environment variables:
M00N_SERVER_URL=https://app.m00n.report
M00N_API_KEY=m00n_xxxxxxxxxxxxx
M00N_LAUNCH="Nightly Build"
M00N_TAGS=unit,integrationUsage Examples
Basic Configuration
reporters: [
'default',
['@m00nsolutions/jest-reporter', {
serverUrl: 'https://app.m00n.report',
apiKey: process.env.M00N_API_KEY,
}],
],Jest 29+ API Support
This reporter implements the full Jest reporter API:
Lifecycle Hooks
| Hook | Description |
|------|-------------|
| onRunStart | Called when the test run begins |
| onTestFileStart | Called when a test file starts executing |
| onTestCaseStart | Called before each individual test runs |
| onTestCaseResult | Called after each individual test completes |
| onTestResult | Called when a test file finishes |
| onRunComplete | Called when the entire run completes |
Reporter Context (Jest 28+)
The reporter receives context about:
firstRun- Whether this is the first run in watch modepreviousSuccess- Whether the previous run succeededchangedFiles- Files that changed since last run
Retry Support
The reporter automatically tracks test retries when using Jest's retry feature:
// jest.config.js
module.exports = {
// Enable retries for flaky tests
retryTimes: 2,
// Only retry in CI
...(process.env.CI && { retryTimes: 3 }),
};Each retry attempt is tracked separately in the dashboard with:
- Attempt number
- Retry reasons
- Individual timing
License
MIT License - see LICENSE for details.
