
# Installing TestGlance for any JUnit-XML producing test framework

Almost every test framework can emit JUnit XML, either natively or with a
plugin. If yours isn't on the supported list, follow this generic recipe.

## 1. Make tests emit JUnit XML

1. Find your framework's JUnit XML reporter. Search for
   `<framework name> junit xml reporter` — most ecosystems have one.
   Common ones:
   - Bun: `bun test --reporter=junit --reporter-outfile=test-results/bun.xml`
   - Rust: `cargo test … | cargo2junit > test-results/rust.xml`,
     or `cargo nextest run --profile ci` (configure JUnit output).
   - Elixir: `mix test --formatter JUnitFormatter` via the
     `junit_formatter` hex package.
   - Swift / XCTest: use `xcpretty -r junit -o test-results/xcode.xml`.

2. Configure it to write XML files under `test-results/`. Any path that
   matches `**/test-results/*.xml` is auto-discovered by TestGlance.

3. Make sure the reporter runs in CI (often gated on `CI=true`).

## 2. Add the TestGlance step to CI

If the project already has a CI workflow that runs the tests, add this step
to the test job (after the test step), and merge the `permissions:` block at
the workflow's top level:

```yaml
permissions:
  contents: read
  pull-requests: write

# ...inside the test job, after the test step:
- uses: testglance/action@v1
  if: always()
  with:
    github-token: ${{ github.token }}
```

If no CI workflow runs the tests yet, create
`.github/workflows/testglance.yml` that runs the project's tests and then
runs the TestGlance step.

`if: always()` matters — TestGlance should still run when tests fail.
TestGlance auto-discovers anything matching `**/test-results/*.xml`, so no
`report-path` is needed when reports land under `test-results/`.

## 3. Confirm with the user before committing

Summarize the diff and ask the user to confirm before staging or
committing. Do not push.
