Testing Rules
Rules that integrate automated testing into the build pipeline.
Rules
| Rule | Default | Effect |
|---|---|---|
max_auto_test_duration_ms | 5000 | Maximum time in milliseconds for the automatic tests/auto suite |
How tests/auto Works
When a project contains a tests/auto/ directory and a compiled morph executable at build/bin/morph, the compiler uses the native test framework as a build gate.
Build Gate Flow
- Source files are compiled.
- If
build/bin/morphexists andtests/auto/exists:- the compiler runs
build/bin/morph test tests/auto - if tests fail, the build is blocked
- if tests exceed the configured time limit, the build is blocked
- the compiler runs
- Only after the automatic test suite passes does the build succeed
On Failure
Build blocked: automated tests failed.
On Timeout
Build blocked: automated tests exceeded 5000 ms (actual: 7234 ms).
Project Structure
my_project/
|-- tests/
| |-- auto/ <- auto-run Morph tests live here
| `-- unit/ <- optional manual or non-gated tests
`-- build/
`-- bin/
`-- morph <- test runner executable
Each .mx file in tests/auto/ should follow the same native rule used by the repository behavior suite:
- one
.mxfile = one scenario - exactly one top-level
test {}block per file - expectations written in source through
Std.Test
Why This Matters
This keeps source verification inside the language itself:
- builds run Morph-authored tests, not an external sidecar framework
- failing tests block the build immediately
- slow auto suites also block the build
- agents must fix broken source behavior before the change can land