Action to test Node.js projects with support for coverage reporting and pull request annotations
- uses: hoverkraft-tech/ci-github-nodejs/actions/test@ce2467e5d41ff0abe85094dcc39c98288448065a # 0.20.4
with:
# Working directory where test commands are executed.
# Can be absolute or relative to the repository root.
#
# Default: `.`
working-directory: .
# Whether running in container mode (skips checkout and node setup)
# Default: `false`
container: "false"
# npm/pnpm/Yarn script command to run for testing.
# This should be a script defined in your `package.json`.
# The command should generate coverage report files in a standard format (Cobertura XML, lcov, etc.).
#
# Default: `test:ci`
command: test:ci
# Code coverage reporter to use. Supported values:
# - `github`: Parse coverage reports via [parse-ci-reports](https://hoverkraft-tech/ci-github-common/actions/parse-ci-reports) action, with GitHub summaries/PR comments
# - `codecov`: Upload coverage to Codecov
# - `""` or `null`: No coverage reporting
#
# Default: `github`
coverage: github
# Optional test and coverage report paths forwarded to the [parse-ci-reports](https://hoverkraft-tech/ci-github-common/actions/parse-ci-reports) action.
# Supports multiple formats (Cobertura, OpenCover, lcov, etc.).
# Provide absolute paths or paths relative to the working directory.
# Multiple entries can be separated by newlines, commas, or semicolons.
# When omitted, the action falls back to `auto:test,auto:coverage` detection.
report-file: ""
# Optional path mapping to adjust file paths in test and coverage reports.
# See the [parse-ci-reports documentation](https://hoverkraft-tech/ci-github-common/actions/parse-ci-reports) for details.
path-mapping: ""
# GitHub token for coverage PR comments.
# Required when coverage is set to `github`.
github-token: ""| Input | Description | Required | Default |
|---|---|---|---|
working-directory |
Working directory where test commands are executed. | false | . |
| Can be absolute or relative to the repository root. | |||
container |
Whether running in container mode (skips checkout and node setup) | false | false |
command |
npm/pnpm/Yarn script command to run for testing. | false | test:ci |
This should be a script defined in your package.json. |
|||
| The command should generate coverage report files in a standard format (Cobertura XML, lcov, etc.). | |||
coverage |
Code coverage reporter to use. Supported values: | false | github |
- github: Parse coverage reports via parse-ci-reports action, with GitHub summaries/PR comments |
|||
- codecov: Upload coverage to Codecov |
|||
- "" or null: No coverage reporting |
|||
report-file |
Optional test and coverage report paths forwarded to the parse-ci-reports action. | false | - |
| Supports multiple formats (Cobertura, OpenCover, lcov, etc.). | |||
| Provide absolute paths or paths relative to the working directory. | |||
| Multiple entries can be separated by newlines, commas, or semicolons. | |||
When omitted, the action falls back to auto:test,auto:coverage detection. |
|||
path-mapping |
Optional path mapping to adjust file paths in test and coverage reports. | false | - |
| See the parse-ci-reports documentation for details. | |||
github-token |
GitHub token for coverage PR comments. | false | - |
Required when coverage is set to github. |
Contributions are welcome! Please see the contributing guidelines for more details.
This project is licensed under the MIT License.
SPDX-License-Identifier: MIT
Copyright © 2025 hoverkraft
For more details, see the license.
This documentation was automatically generated by CI Dokumentor.