The JavaScript test suites use Mocha and Chai.
Use Node.js 24.22.1 and run commands from the repository root. Install dependencies with
npm ci as described in the local setup guide.
npm run test:unit-testsUnit tests are under test/unit-tests/ and do not require database population.
For the coverage check used in CI:
npm run action:coverageIntegration tests are under test/integration-tests/. They exercise the application with a
MongoDB replica set, including operations that use transactions. Initialize and install the
migration tooling before running them:
git submodule update --init migrations
npm ci --prefix migrations --include=devBoth integration commands below automatically drop and rebuild the selected database, seed
data, and apply pending migrations before running the suite. They pass y to population,
so there is no confirmation prompt. Use a disposable local cve_test database.
Start the three-member MongoDB replica set using the command in the
local setup guide, and wait for
mongo-init to report readiness. Set LOCAL_KEY in the repository root .env to the
example fixture key shown there, which matches the suite's request headers, then run:
MONGO_DB_NAME=cve_test npm run test:integration:replicasThis script sets NODE_ENV=test and supplies a connection string for 127.0.0.1 ports
27017, 27018, and 27019, replica set rs0, and database cve_test. The explicit
MONGO_DB_NAME=cve_test also keeps population and migrations on that database if a different
database name is configured in your environment.
Follow the Docker setup, then run:
docker compose -f docker/docker-compose.yml exec -e MONGO_DB_NAME=cve_test cveawg npm run test:integrationThe documented Docker environment uses the docdb hostname and chooses cve_test from the
test configuration. Keep MONGO_CONN_STRING= empty in docker/.docker-env for this setup;
an override pointing at cve_dev would also affect the test application. The host-specific
test:integration:replicas command is for the Mongo-only Compose setup.
To populate test data separately without starting the suite, use npm run populate:test
with the connection configured for cve_test. This command also resets the database, but
asks for confirmation. Existing data that only needs migrations can use npm run db:migrate:test
with the same test database configuration.
GitHub Actions runs unit tests and coverage and
Docker integration tests on pull requests.
The repository does not install a Git hook that blocks local pushes based on test results.
Use the suite-specific commands above when checking failures: the broad npm test script
ends with || true and does not propagate a failing test exit status.