To set up your local development environment for working on this project, follow these steps:
Make sure you have Node.js and npm installed on your machine.
This package is built using node v19
, so it is recommended to use that version.
We use Test Containers for running integration tests.
In our Test Containers setup we use Docker Compose, as our tests involve multiple containers that need to be orchestrated together.
If you want to run integration tests, you need Docker and Docker Compose installed on your machine.
Make sure that you install all the project dependencies:
npm install
In order to build the project, we need to run the following command:
npm run build
the build generated will be placed in dist
folder.
npm run test
npm run test:unit
npm run test:integration
The integration testing environment uses different environment variables, defined in a .env file, available in the test/integration/environment folder.
These environment variables can be updated as needed for integration testing. For example, we can specify the Dataverse image registry and tag, to point to the particular Dataverse image to test.
-
To test images generated in Dataverse PRs: Set
ghcr.io
as the image registry (DATAVERSE_IMAGE_REGISTRY) and the source branch name of a particular PR as the image tag (DATAVERSE_IMAGE_TAG). -
To test the Dataverse develop branch: Set
docker.io
as the image registry (DATAVERSE_IMAGE_REGISTRY) andunstable
as the image tag (DATAVERSE_IMAGE_TAG).
npm run test:coverage
If you want to see the container logs while running integration or functional tests, run the following command before running the test commands:
export DEBUG=testcontainers:containers npm test
npm run format
Running a linting check on the code:
npm run lint
Fix linting checks on the code:
npm run lint:fix