Junit (junit-xml)

The JUnit reporter is great for interop with CI/CD products that take a junit-xml test result format (probably most if not all of them).

Using this format, a Spectral scan is similar to a test scan. When there are real findings, Spectral will generate a failing test that you can inspect in your CI dashboard like any other test.

Here's how to configure in your spectral.yaml:

.spectral/spectral.yaml
reporter:
outputs:
junit: {}

This will output the XML results in junit-out. To pick it up, for example with Circle CI, make sure to point your CI to this folder:

.circleci/config.yml
version: 2
jobs:
build:
docker:
- image: circleci/node:latest
steps:
- checkout
- run: spectral run
- store_test_results:
path: ./junit-out/