This is a Github Action to run unit tests and display the failed tests in the Files Changed of PRs.
This action is a work in progress, it has been worked on during an inspiration sprint. It is not a completed project and has room for improvement.
If the action does not work as expected or if it does not support a testing framework you would like to use, please open up an issue and message Louis Coste.
Currently the supported testing frameworks are:
In order to use this GtiHub Action with Karma you will need to add a package to your modules.
Make sure to add "karma-json-reporter": "^1.1" to your devDependencies.
This tool uses the npm scripts and modifies them slightly to be able to parse the results.
The result is then parsed and it might not always contain the file location where errors happen.
Add a workflow file to your repository using the following template.
<mocha|karma>: Testing framework used in thenpm testcommand<npm script command>: The npm script to run, without thenpm run. (Defaults totest)
name: Test
on:
push:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: Brightspace/third-party-actions@actions/checkout
- uses: Brightspace/unit-test-action@v1.0.1
with:
test-type: <mocha|karma> # Without the angle brackets
test-script: <npm script command> # Without the angle brackets
token: ${{ secrets.GITHUB_TOKEN }}
If you are using the karma testing framework then you also need to add
"karma-json-reporter": "^1.1" to your devDependencies
All version changes should obey semantic versioning rules.
This repo uses the semantic-release GitHub action to manage GitHub releases. The commit message format for initiating releases is specified in that semantic-release GitHub action.
Supported commit prefixes:
| Commit prefix | Version Increase |
|---|---|
fix: |
PATCH |
perf: |
PATCH |
feat: |
MINOR |
BREAKING CHANGE: |
MAJOR |
Example commit: feat: Adding error page will increment the MINOR version.