node-test-github-reporter is a utility designed to integrate the native Node.js test runner results directly into GitHub's Pull Request checks and annotations. It processes the test output from the Node.js `--test` command and formats it for visibility within the GitHub UI, providing a quick overview of test outcomes and detailed inline annotations for failures. The package is currently stable at version 1.3.1 and appears to follow a frequent patch/minor release cadence, primarily driven by dependency updates. Its key differentiator is its seamless integration with the built-in Node.js test runner, requiring no additional testing frameworks, and its focus on improving developer experience within GitHub workflows by making test results immediately visible and actionable. It aims to streamline CI feedback loops for Node.js projects utilizing the native test runner.
npm install node-test-github-reporterVerified import paths — ran on the pinned version, not inferred.
Demonstrates setting up a basic Node.js test file and executing it with the `node-test-github-reporter` to integrate results with GitHub Actions checks.
Ensure the GitHub Actions workflow grants appropriate permissions (e.g., `permissions: write-all` or specific `checks: write`, `pull-requests: write`) and passes the `GITHUB_TOKEN` to the job. Verify environment variables like `GITHUB_SHA` and `GITHUB_REPOSITORY` are available in the action's context.
For combined usage, always specify `--test-reporter-destination stdout` for reporters whose output you want in the console, and rely on the GitHub reporter to handle its own internal reporting mechanism without needing an explicit destination for GitHub interaction.
Ensure your project is exclusively using the `node:test` module for its testing infrastructure. For other frameworks, seek out their specific GitHub integration reporters.
Verify that your GitHub Actions workflow has sufficient permissions (`pull-requests: write` or `checks: write`) and that the `GITHUB_TOKEN` is correctly passed to the job executing the tests. Ensure other required GitHub environment variables are present.
Run `npm install --save-dev node-test-github-reporter` or `yarn add --dev node-test-github-reporter` to ensure the package is installed as a development dependency.
The Node.js native test runner only supports `stdout` or `stderr` as destinations for built-in or custom reporters. Correct the flag to `--test-reporter-destination stdout` or `--test-reporter-destination stderr`.