Tests in devenv let you verify that your development environment is working as expected. You define test logic in theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/cachix/devenv/llms.txt
Use this file to discover all available pages before exploring further.
enterTest hook inside devenv.nix, then run devenv test to build the environment and execute your tests. If you have processes defined, devenv starts and stops them automatically around the test run.
Writing Your First Test
A simple test verifies that a package is present and returns the expected version:devenv.nix
By default,
enterTest also detects if a .test.sh file exists in your project root and runs it.Testing with Processes
If you have processes defined in your environment, they will be started before your tests run and stopped automatically afterward:devenv.nix
Helper Functions in enterTest
The following helper functions are available inside enterTest:
wait_for_port <port> <timeout>— waits until the given port is open before continuing
Using Tasks for Test Dependencies
For more complex test setups with dependencies and better control over parallelism, use tasks with thebefore attribute to hook into devenv:enterTest:
devenv.nix
devenv:enterTest run first and can be parallelized, making them a good fit for seeding databases, generating fixtures, or waiting on external services.
Changing Environment During Tests
You can useconfig.devenv.isTesting to conditionally include or exclude processes and configuration depending on whether devenv test is running:
devenv.nix
CI Integration
Runningdevenv test in CI is the recommended way to verify your environment and run all checks, including:
- Git hooks / pre-commit checks (if git-hooks are configured)
enterTestassertions- Process startup and readiness
