https://github.com/sapphi-red/vitest-github-actions-reporter
Vitest reporter to create annotations when running tests in GitHub Actions
https://github.com/sapphi-red/vitest-github-actions-reporter
vitest vitest-reporter
Last synced: 5 months ago
JSON representation
Vitest reporter to create annotations when running tests in GitHub Actions
- Host: GitHub
- URL: https://github.com/sapphi-red/vitest-github-actions-reporter
- Owner: sapphi-red
- License: mit
- Created: 2022-03-02T08:04:06.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-02-21T07:44:17.000Z (about 1 year ago)
- Last Synced: 2024-12-09T01:51:26.415Z (5 months ago)
- Topics: vitest, vitest-reporter
- Language: TypeScript
- Homepage:
- Size: 519 KB
- Stars: 49
- Watchers: 1
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vitest-github-actions-reporter
[](https://badge.fury.io/js/vitest-github-actions-reporter)  [](LICENSE)
Vitest reporter to create annotations when running tests in GitHub Actions.
> [!WARNING]
> **[Vitest 1.3.0+](https://github.com/vitest-dev/vitest/releases/tag/v1.3.0) comes with [a builtin support for creating annotations in GitHub Actions](https://vitest.dev/guide/reporters.html#github-actions-reporter).**
> This reporter is not needed for those versions.
Thanks to [`jest-github-actions-reporter`](https://github.com/cschleiden/jest-github-actions-reporter) for the ideas.
## Install
```shell
npm i -D vitest-github-actions-reporter # yarn add -D vitest-github-actions-reporter
```## Usage
Add this reporter to `vite.config.js` / `vite.config.ts`.
```js
// vite.config.js / vite.config.ts
import GithubActionsReporter from 'vitest-github-actions-reporter'export default {
test: {
reporters: process.env.GITHUB_ACTIONS
? ['default', new GithubActionsReporter()]
: 'default'
}
}
```Then run `vitest` with GitHub Actions.
That's all. GitHub Actions will do everything other.## Options
### `trimRepositoryPrefix`
_Default: `true`_
Trims `/home/runner/{repository name}` / `D:\a\{repository name}` in stacktrace.
The image below is a preview when it is `false`.
### `hideStackTrace`
_Default: `false`_
Hides stack trace in the message.
The image below is a preview when it is `true`.
