- Review the CONTRIBUTING guidelines
- NodeJS to match the version here
Install dependencies
npm iRun for dev mode
npm run devBuild for prod
npm run buildWe are using Vitest and Testing Library for our unit tests.
Please aim for about 80% or greater test coverage. Perfection on metrics can often be the wrong target, so we aim for "good enough"
Automated tests are incorporated into GitHub Actions so we can easily see if our application is safe to deploy.
You can run the unit tests like so:
Command lines
npm run testnpm run test:uiWhen writing new tests, please follow the Testing Library Guiding Principles
We use Playwright for end-to-end (E2E) tests. Whereas unit tests take a narrow focus, E2E should be written to capture user journeys throughout the site, such as complex interactions.
On localhost, you must have the dev server running before running the following commands. You can run it in terminal mode with:
npm run test:e2eor in UI mode with:
npm run test:e2e:uiPlaywright runs against the main branch automatically via GitHub Actions. Currently, it runs inside a container via the action rather than production. If you see a failure in CI/CD, here's how to inspect it:
- Go to the "Actions" tab and select the failing run
- Examine the logs, and download the artifact
- Unzip the artifact to find one or more folders with the name of the test. Each folder should contain a file called
trace.zip. - Open up the Trace Viewer, which is a Progressive Web App (basically a special site that runs locally on your machine, not on a server).
- Drag the
trace.zipfile into the Trace Viewer and you can see the screenshots from the test run
To update the event list from the Connpass API, use the script at scripts/update-events.sh.
curljqCONNPASS_API_KEYenvironment variable set
- Copy
.envrc.sampleto.envrcand set your API key:cp .envrc.sample .envrc # Edit .envrc and set your CONNPASS_API_KEY - Load the environment variable:
- If you use direnv (recommended):
direnv allow
- Or, source manually:
source .envrc
- If you use direnv (recommended):
./scripts/update-events.shdocker run -v $PWD:/target -e "CONNPASS_API_KEY=$CONNPASS_API_KEY" dwdraju/alpine-curl-jq bash /target/scripts/update-events.sh