Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 1.7 KB

README.md

File metadata and controls

45 lines (32 loc) · 1.7 KB

Getting Captain working with Jest

Starting from a simple workflow that runs jest, we want to

1. 🧪 Ensure jest produces json output

jest --json --outputFile tmp/jest.json will produce Captain-compatible json output in tmp/jest.json. We get useful location information if you also include --testLocationInResults

npm test -- --json --testLocationInResults --outputFile tmp/jest.json

2. 🔐 Create an Access Token

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.

3. 💌 Install the Captain CLI and call it when running tests

See the full documentation on test suite integration.

- uses: rwx-research/setup-captain@v1
- name: Run tests
  run: |
    captain run \
      --suite-id captain-examples-jest \
      --test-results tmp/jest.json \
      --  \
      npm test -- --json --outputFile=tmp/jest.json --testLocationInResults
  env:
    RWX_ACCESS_TOKEN: ${{ secrets.RWX_ACCESS_TOKEN }}

4. 🎉 See your test results in Captain!

Take a look at the final workflow!