vix tests
vix tests runs project tests.
Use it when you want to execute the test suite of a Vix or CMake project with a clean Vix-native output.
vix testsOverview
vix tests is the test runner command of the Vix CLI.
It detects the current project, resolves the build directory from the selected preset, runs the available test backend, summarizes results, and reports failures with a clean Vix diagnostic format.
Even when Vix uses CTest internally, the command stays a Vix command from the user's point of view.
Usage
vix tests [path] [options] [-- raw-runner-args...]What it does
vix tests can:
- run all tests in the current project
- run tests in another project directory
- run tests from a selected preset
- run a single test or a filtered group of tests
- list tests
- stop on the first failure
- run tests in watch mode
- run runtime checks after tests
- show clean Vix test diagnostics
- show more structured details with
-v - show raw internal runner output with
--raw - pass raw internal runner arguments after
--
Basic usage
# Run tests in the current project
vix tests
# Run tests in another project
vix tests ./examples/blog
# Run tests with a specific preset
vix tests --preset releaseOutput style
vix tests uses the same visual style as vix build.
Example success:
Testing all (dev)
* engine: vix | jobs: 8
tests [============================] done
✔ Passed 23 tests in 0.1sExample failure:
Testing all (dev)
* engine: vix | jobs: 8
tests [============================] failed
✖ Failed 1 of 23 tests after 0.1s
failed:
kv_test_open
error:
FAILED: fast database should not be memory_only
➜ Run `vix tests -v` to show detailed Vix test output.
➜ Run `vix tests --raw` to show raw runner output.By default, Vix does not dump the raw internal runner output. It extracts the useful failure information and presents it clearly.
Run all tests
vix testsThis runs the test suite for the current project.
Vix resolves the build directory from the active preset. If no preset is provided, it uses dev-ninja.
Run tests from another project
vix tests ./examples/blogThe first path-like argument is treated as the project directory.
Presets
vix tests --preset releaseIf no preset is provided, Vix defaults to:
dev-ninjaCommon presets:
vix tests --preset dev
vix tests --preset dev-ninja
vix tests --preset releasePreset mapping:
| Preset | Build directory |
|---|---|
dev | build-dev |
dev-ninja | build-ninja |
release | build-release |
Run one test
Use --test to run one test or tests matching a pattern.
vix tests --test kv_test_segmentYou can also use -R as an alias:
vix tests -R kv_test_segmentThis is the Vix-native way to do what you would normally do with:
ctest --test-dir build-ninja -R kv_test_segment --output-on-failureBut with vix tests, you do not need to think about the build directory or the internal runner.
Example output:
Testing kv_test_segment (dev)
* engine: vix | jobs: 8
tests [============================] done
✔ Passed 1 test in 0.1sRun tests matching a pattern
--test accepts a name or pattern.
vix tests --test kv_test
vix tests --test persistence
vix tests -R walThis is useful when you want to focus on a specific area while developing.
Verbose mode
Use -v or --verbose to show more Vix-formatted details.
vix tests -v
vix tests --verbose-v should not expose raw internal runner output. It keeps the Vix interface and shows structured details.
Example:
Testing all (dev)
* engine: vix | jobs: 8
tests [============================] failed
✖ Failed 1 of 23 tests after 0.1s
failed:
kv_test_open
error:
FAILED: fast database should not be memory_only
details:
kv_test_open
FAILED: fast database should not be memory_onlyRaw mode
Use --raw only when you want to inspect the raw output of the internal test runner.
vix tests --rawRaw mode is useful when debugging the runner itself or when you need the exact backend output.
Example:
vix tests --test kv_test_segment --rawNormal development should use:
vix tests
vix tests -v
vix tests --test nameJobs and parallel execution
vix tests runs tests with parallel execution when supported.
Example output:
Testing all (dev)
* engine: vix | jobs: 8
tests [============================] done
✔ Passed 23 tests in 0.1sThe jobs value is derived from available CPU threads, with a safe upper limit.
When Vix uses CTest internally, it passes parallel execution to the runner automatically.
Watch mode
Use --watch to watch project files and re-run tests when files change.
vix tests --watchVix watches relevant project files such as:
.cpp.cc.cxx.hpp.hh.hxx.h.cmakeCMakeLists.txtCMakePresets.json
It ignores generated or unrelated directories such as:
.git.idea.vscode- build directories
dist
Run runtime checks after tests
Use --run to run runtime checks after tests pass.
vix tests --runIf tests fail, runtime checks are not executed.
This is useful when you want:
tests first, runtime validation secondList tests
vix tests --listThis lists available tests for the current project.
You can combine it with a pattern:
vix tests --list --test kv
vix tests --list -R walFail fast
Use --fail-fast to stop after the first failing test.
vix tests --fail-fastThis is useful when you want fast feedback during debugging.
Raw runner arguments
Arguments after -- are passed to the internal test runner.
vix tests -- --output-on-failure
vix tests -- -R MySuite
vix tests -- --output-on-failure -R AuthFor normal Vix usage, prefer the Vix-native options:
vix tests -v
vix tests --test MySuite
vix tests --rawUse raw runner arguments only when you need a backend-specific option.
Native runner and fallback
vix tests prefers a native test runner when available.
If no native runner is found, Vix falls back to the available project test backend.
The interface remains the same:
vix testsVix should not make the command feel like a direct CTest wrapper. Internal tools are implementation details.
When tests are not configured yet
If the build directory does not exist or tests were not generated, Vix reports a clear message.
Example:
✖ No build directory found for tests.
➜ Run `vix build --build-target all` first.Recommended setup:
vix build --build-target all
vix testsOptions
| Option | Description |
|---|---|
--watch | Watch files and rerun tests on changes. |
--run | Run runtime checks after tests pass. |
--list | List available tests. |
--test <name|pattern> | Run tests matching a name or pattern. |
-R <name|pattern> | Alias for --test. |
--fail-fast | Stop after the first failing test. |
-v, --verbose | Show detailed Vix-formatted test output. |
--raw | Show raw internal test runner output. |
--preset <name> | Use a specific preset. |
-- | Pass raw arguments to the internal test runner. |
-h, --help | Show command help. |
Common workflows
# Run all tests
vix tests
# Run tests while editing
vix tests --watch
# Run tests and runtime checks
vix tests --run
# Run tests in release preset
vix tests --preset release
# List tests
vix tests --list
# Stop on first failure
vix tests --fail-fast
# Show detailed Vix output
vix tests -v
# Show raw internal runner output
vix tests --raw
# Run one test
vix tests --test kv_test_segment
# Run one test with short syntax
vix tests -R kv_test_segment
# Run tests matching a pattern
vix tests --test wal
# Run one test in release mode
vix tests --preset release --test kv_test_segmentCommon mistakes
Using raw runner syntax when Vix has a native option
Avoid this for normal usage:
vix tests -- -R kv_test_segment --output-on-failurePrefer:
vix tests --test kv_test_segmentOr:
vix tests -R kv_test_segmentExpecting -v to show raw backend output
-v shows detailed Vix-formatted output.
For raw backend output, use:
vix tests --rawForgetting to build tests first
If tests were not generated yet, run:
vix build --build-target all
vix testsPassing raw runner options without --
Wrong:
vix tests --output-on-failureCorrect:
vix tests -- --output-on-failureBut for most cases, prefer:
vix tests -vConfusing build preset and log level
Wrong:
VIX_LOG_LEVEL=release vix testsCorrect:
vix tests --preset releaseVIX_LOG_LEVEL controls logging. --preset release controls the build/test preset.
Troubleshooting
Need to see the failing test message
vix testsVix shows the first useful failure message automatically.
For more structured detail:
vix tests -vFor raw backend output:
vix tests --rawNeed to run only one failing test
vix tests --test kv_test_openOr:
vix tests -R kv_test_openNeed to stop after the first failure
vix tests --fail-fastNeed to list tests
vix tests --listNeed to run tests from another folder
vix tests ./examples/blogNeed to use release mode
vix build --preset release --build-target all
vix tests --preset releaseRecommended validation flow
During development:
vix testsWhen debugging one failure:
vix tests --test failing_test_name
vix tests -v --test failing_test_nameBefore committing:
vix fmt --check
vix build --build-target all
vix testsFor stricter validation:
vix check --san --testsFor release preparation:
vix build --preset release --build-target all
vix tests --preset release
vix check --san --fullDifference between vix tests, vix check --tests, and raw runner usage
| Command | Purpose |
|---|---|
vix tests | Run tests with clean Vix-native output. |
vix tests -v | Run tests with detailed Vix-formatted output. |
vix tests --raw | Show raw internal runner output. |
vix check --tests | Run tests as part of the broader validation workflow. |
vix tests -- ... | Pass backend-specific arguments to the internal runner. |
Related commands
| Command | Purpose |
|---|---|
vix check --tests | Build and run tests as part of validation. |
vix check --san --tests | Run tests with sanitizers. |
vix build | Configure and build the project. |
vix fmt | Format source files. |
vix dev | Run the app in development mode. |
vix run | Build and run an application manually. |
Next step
Continue with reusable project tasks.