Principle:Nightwatchjs Nightwatch Results And Reporting
| Knowledge Sources | |
|---|---|
| Domains | Testing, Reporting |
| Last Updated | 2026-02-12 00:00 GMT |
Overview
A test result aggregation and reporting pattern that collects execution outcomes and formats them for human review or CI/CD integration.
Description
After test execution completes, results must be collected, aggregated, and reported in consumable formats. Test reporting serves two audiences: developers reviewing test runs (console output, HTML reports) and CI/CD systems consuming machine-readable formats (JUnit XML). The reporting system supports a custom reporter hook that receives the complete results object, enabling user-defined processing such as sending notifications, writing custom formats, or integrating with external dashboards.
Usage
Use this principle to understand how test results are captured and reported. The built-in JUnit XML reporter writes to tests_output/ by default. Custom reporters can be defined in the globals module for additional processing.
Theoretical Basis
The reporting pipeline follows a collect-aggregate-format pattern:
- Collect individual test results (pass/fail/skip/error per assertion)
- Aggregate results by test suite, then by overall run
- Format via configured reporters (JUnit XML, HTML, custom)
- Invoke custom reporter hook with aggregated results
- Output to file system and/or console