Skip to content

Latest commit

 

History

History
103 lines (62 loc) · 2.34 KB

localDevelopment.md

File metadata and controls

103 lines (62 loc) · 2.34 KB

Local Development

To set up your local development environment for working on this project, follow these steps:

Prerequisites

Node.js and npm

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.

Docker and Docker Compose

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.

Install Dependencies

Make sure that you install all the project dependencies:

npm install

Build

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.

Tests

Run all tests

npm run test

Run unit tests

npm run test:unit

Run integration tests

npm run test:integration

Configure the integration testing environment

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) and unstable as the image tag (DATAVERSE_IMAGE_TAG).

Run test coverage

npm run test:coverage

Display container logs while running tests

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

Format and lint

Run formatter

npm run format

Run linter

Running a linting check on the code:

npm run lint

Fix linting checks on the code:

npm run lint:fix