Create custom Jest JSON reporter
Summary
Create a custom Jest reporter that outputs test metadata in JSON format compatible with gitlab_quality-test_tooling gem, enabling frontend test metric export to ClickHouse.
Problem
GitLab exports backend (RSpec) test metric to ClickHouse for analytics, but frontend (Jest) metrics are not included. To enable frontend metrics export, we need Jest test metadata in a format the gitlab_quality-test_tooling gem can process.
Proposal
Build a custom Jest reporter that generates JSON output matching the RSpec JSON formatter structure.
Desired output structure:
{
"examples": [
{
"id": "spec/frontend/boards/board_spec.js[...]",
"description": "renders correctly",
"full_description": "BoardComponent renders correctly",
"status": "passed",
"file_path": "spec/frontend/boards/board_spec.js",
"line_number": 15,
"run_time": 0.123,
"feature_category": null,
"ci_job_url": "https://...",
"retry_attempts": 0
}
],
"summary": {
"duration": 45.678,
"example_count": 1234,
"failure_count": 5,
"pending_count": 2
}
}
Edited by Richard Chong