Contributing to Sanity Runner
Getting Started
Optionally install nvm to ensure you're using the correct version of node. You can find the node version in the .nvmrc
file. Once you have the right version of node selected, you'll want to enable corepack via corepack enable
.
Install dependencies.
yarn
This project uses Typescript and Yarn Berry.
Linting
TypeScript is linted with ESLint, while Terraform is linted with tflint.
To run ESLint:
yarn lintyarn lint:fix
and for Terraform:
yarn workspace sanity-runner-terraform lintyarn workspace sanity-runner-terraform lint:fix
Build
You can execute yarn build
to generate the build assets that ultimately gets uploaded to the NPM registry. It will also leave the intermediate lib
artifacts, which contain the transpiled code.
Running Local Tests
Followed by:
yarn build
Open 2 terminals, one for the service and one for the client.
In the service terminal execute:
SANITY_RUNNER_SLOW_MO=1000 yarn dev:service
One the service is up and running, execute:
yarn dev:client --test-dir example/repo/sanities/ --include google-fail-example -vv
To run the production image (no mounting), run:
yarn workspace sanity-runner-service run docker:prod
In tests, some globals are exposed, such as browser
, page
, and pause
(used for debugging). To add a breakpoint when using the local service:
await global.pause()