Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/IgnusG/jest-report-action
Jest Reporter Action made easy - ish
https://github.com/IgnusG/jest-report-action
github-action jest junit
Last synced: 3 months ago
JSON representation
Jest Reporter Action made easy - ish
- Host: GitHub
- URL: https://github.com/IgnusG/jest-report-action
- Owner: IgnusG
- License: unlicense
- Created: 2020-04-05T20:33:08.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-12-04T11:53:43.000Z (about 1 year ago)
- Last Synced: 2024-10-26T10:46:35.017Z (3 months ago)
- Topics: github-action, jest, junit
- Language: JavaScript
- Size: 2.39 MB
- Stars: 16
- Watchers: 1
- Forks: 5
- Open Issues: 30
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-actions - Display Inline Code Annotations for Jest Tests
- fucking-awesome-actions - Display Inline Code Annotations for Jest Tests
- awesome-workflows - Display Inline Code Annotations for Jest Tests
README
# Jest Github Actions Reporter
Creates annotations based on the output of `jest-junit` (see [how to configure `jest-junit` properly](./README.md#jest-junit-configuration)) in your test files.
## Example
.github/workflows/your-workflow.yml
```
- uses: IgnusG/jest-report-action@v{ current version }
if: always() # Or use "continue-on-error: true" in previous test step
with:
access-token: ${{ secrets.GITHUB_TOKEN }}
```## Inputs
### `access-token` - **required**
We'll need that to enrich the actions run with annotations. The secret is automatically generated by github.com.
### `junit-file` - *optional*
The location and/or the name of the JUnit file. `jest-junit` uses junit.xml as a default, which is the default here too. If you haven't changed it, you can omit this input.
### `run-name` - *optional*
The name of your run. This is typically `build` but can be configured individually. Make sure it matches your workflow config:
.github/workflows/your-workflow.yml
```yaml
build: # <- this one!
steps:
...
```### `check-name` - *optional*
A custom name that will appear in the PR's check window. Useful if you have multiple test suites - code, pipelines, publishing process etc., each run with separate jest commands.
Be sure to run this action after each jest run, that way you can use the same name for the JUnit file - or omit it.Otherwise you have to give each generated JUnit file a unique name and pass it to `jest-report-action`.
### `working-directory` - *optional*
The working directory, where the `junit-file`, as well as the sources (of test files) can be found. The default is the root directory of your project.
## `jest-junit` Configuration
Have a look at how to call `jest-junit` in your workflows in the [documentation](https://www.npmjs.com/package/jest-junit#usage).
A very simple example is calling jest with a custom `--reporters` parameter:package.json and other
```
jest --ci --reporters=default --reporters=jest-junit
```To provide **correct annotation locations**, you need to configure `jest-junit` to format the xml file in a compatible way.
Set these in either your package.json or through enviornment variables while running jest in your CI (Github).
package.json
```json
"jest-junit": {
"suiteNameTemplate": "{filepath}",
"classNameTemplate": "{classname}",
"titleTemplate": "{title}"
}
```Refer to [`jest-junit` Documentation](https://www.npmjs.com/package/jest-junit#configuration) to see other ways to configure these.
Thank you and have an **amazing day**!