Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 1.16 KB

CONTRIBUTING.md

File metadata and controls

44 lines (31 loc) · 1.16 KB

Contributing

This guide will get you started with being able to build and run the test suite for this application.

Requirements

Setup

  • Clone the repository
  • Install dependencies npm i
  • Build the wasm for tests npm run build-wasm
  • Run the tests npm test

adding e2e compiler tests

If you want to run the tests locally, you need to have:

  • Docker for Tree Sitter to build you a .wasm artifact
  • OPA for Jest to build you .wasm policies for evaluation

Jest picks up your tests automatically if you follow these instructions:

  • Add your rule JSON <rule name>.json under test/fixtures
  • With the same name, create a directory <rule name>
  • Create two additional directories allows and denies inside it
  • Any JSON you put in either of those two folders, is picked as an event JSON

npm test output is sorted alphabetically.

Sample directory structure:

- test/fixtures
  - prefix-matching.json
  - prefix-matching
    - allows
      - event1.json
      - event2.json
    - denies
      - event1.json
      - event2.json