Karma does not ship with a JSON reporter built in, so you'll need to install karma-json-reporter
:
npm install --save-dev karma-json-reporter
Once karma-json-reporter
is installed, you can configure Karma with the reporter in your karma.conf.js
file:
reporters: ["progress", "json"],
jsonReporter: {
stdout: false,
outputFile: "tmp/results.json",
},
This configuration will produce Captain-compatible JSON output in tmp/results.json
.
Create an Access Token for your organization within Captain (more documentation here).
Add the new token as an action secret to your repository. Conventionally, we call this secret RWX_ACCESS_TOKEN
.
See the full documentation on test suite integration.
- uses: rwx-research/setup-captain@v1
- name: Run tests
run: |
captain run \
--suite-id captain-examples-karma \
--test-results tmp/results.json \
-- \
npm test
env:
RWX_ACCESS_TOKEN: ${{ secrets.RWX_ACCESS_TOKEN }}
Take a look at the final workflow!