Prerequisites

Docker is required to run the test suite. The tests use DynamoDB Local running in a Docker container.

Make Commands

The Makefile provides convenient commands for development:

CommandDescription
make checkRun all checks: quality and coverage
make qualityRun quality checks: format, credo, hex-outdated, hex-audit, unused-deps
make coverageRun tests with coverage and trace
make testStart DynamoDB Local (if not running) and run the test suite
make test.watchStart DynamoDB Local and run tests in watch mode (re-runs on file changes)
make composeStart only the DynamoDB Local container
make formatCheck code formatting
make credoRun Credo static analysis
make hex-outdatedCheck for outdated dependencies
make hex-auditAudit dependencies for security vulnerabilities
make unused-depsCheck for unused dependencies

Running Specific Tests

You can pass arguments to filter which tests to run:

# Run a specific test file
make test test/read_test.exs

Docker Compose

The docker-compose.test.yml file defines the DynamoDB Local service:

  • Image: amazon/dynamodb-local:latest
  • Port: 8099 (mapped to container's 8000)
  • Mode: In-memory with shared database (-sharedDb -inMemory)

The container is started automatically by the Make commands, but you can also manage it manually:

# Start the container
docker compose -f docker-compose.test.yml up -d

# Stop the container
docker compose -f docker-compose.test.yml down