Registry for tracking which functions are covered by which tests.
This namespace provides the foundation for transitive test coverage proofs. Tests declare which functions they cover via the :covers metadata in the specification macro, and this registry tracks those declarations.
The :covers metadata is a map of {fn-symbol signature-string} where the signature is a short hash of the function's source code at the time the test was written/verified. This enables staleness detection when functions change.
Registry for tracking which functions are covered by which tests.
This namespace provides the foundation for transitive test coverage proofs.
Tests declare which functions they cover via the :covers metadata in the
specification macro, and this registry tracks those declarations.
The :covers metadata is a map of {fn-symbol signature-string} where the
signature is a short hash of the function's source code at the time the
test was written/verified. This enables staleness detection when functions
change.Cross-platform instrumentation functions for mock validation. These wrap stub functions to validate args/return against Malli schemas or Clojure Specs.
Cross-platform instrumentation functions for mock validation. These wrap stub functions to validate args/return against Malli schemas or Clojure Specs.
Tools for verifying transitive test coverage proofs.
This namespace provides functions to verify that a function and all its transitive dependencies have declared test coverage. This enables building a provable chain of tests from low-level functions up to application logic.
Additionally, it supports staleness detection: when a function's source code changes after a test was sealed, the coverage is marked as stale until the developer reviews and re-seals the test.
Configuration:
Configuration is automatically loaded from .fulcro-spec.edn in the project root
when first needed. You can also use configure! to set options programmatically:
Example .fulcro-spec.edn: {:scope-ns-prefixes #{"myapp" "myapp.lib"} :enforce? false}
Or programmatically: (proof/configure! {:scope-ns-prefixes #{"myapp"}})
Tools for verifying transitive test coverage proofs.
This namespace provides functions to verify that a function and all its
transitive dependencies have declared test coverage. This enables building
a provable chain of tests from low-level functions up to application logic.
Additionally, it supports staleness detection: when a function's source code
changes after a test was sealed, the coverage is marked as stale until the
developer reviews and re-seals the test.
Configuration:
Configuration is automatically loaded from `.fulcro-spec.edn` in the project root
when first needed. You can also use `configure!` to set options programmatically:
- :scope-ns-prefixes - set of namespace prefix strings to include (e.g. #{"myapp"})
- :enforce? - when true, when-mocking!! and provided!! will throw on missing coverage
Example .fulcro-spec.edn:
{:scope-ns-prefixes #{"myapp" "myapp.lib"}
:enforce? false}
Or programmatically:
(proof/configure! {:scope-ns-prefixes #{"myapp"}})On-demand signature computation and resealing for staleness detection.
Signatures are short hashes of normalized function source code. When a function's implementation changes, its signature changes, allowing detection of stale test coverage.
The signature is computed by:
Signature format:
The signature function automatically detects leaf vs non-leaf and
returns the appropriate format. Use it for all signature needs.
Resealing (updating :covers signatures in source files):
reseal! updates signatures at a given file/line for IDE integrationIDE keybinding examples: Cursive: (fulcro-spec.signature/reseal! "$FilePath$" $LineNumber$) CIDER: (cider-interactive-eval (format "(fulcro-spec.signature/reseal! "%s" %d)" (buffer-file-name) (line-number-at-pos)))
Performance options (Java system properties):
On-demand signature computation and resealing for staleness detection.
Signatures are short hashes of normalized function source code.
When a function's implementation changes, its signature changes,
allowing detection of stale test coverage.
The signature is computed by:
1. Extracting full source using clojure.repl/source-fn
2. Removing docstrings (so doc changes don't invalidate tests)
3. Normalizing whitespace (so formatting changes don't invalidate tests)
4. Hashing with SHA-256 and taking first 6 characters
Signature format:
- LEAF functions (no in-scope callees): Single-field "xxxxxx"
- NON-LEAF functions: Two-field "xxxxxx,yyyyyy" where:
- xxxxxx: 6-char hash of the function's own source
- yyyyyy: 6-char hash of all transitive callees' signatures
The `signature` function automatically detects leaf vs non-leaf and
returns the appropriate format. Use it for all signature needs.
Resealing (updating :covers signatures in source files):
- `reseal!` updates signatures at a given file/line for IDE integration
IDE keybinding examples:
Cursive: (fulcro-spec.signature/reseal! "$FilePath$" $LineNumber$)
CIDER: (cider-interactive-eval
(format "(fulcro-spec.signature/reseal! \"%s\" %d)"
(buffer-file-name) (line-number-at-pos)))
Performance options (Java system properties):
- fulcro-spec.auto-skip: Enable auto-skipping of already-checked tests
- fulcro-spec.sigcache: Cache signatures for duration of JVMSignatures are a CLJ-only feature. This is here for compilation of CLJC without issues.
Signatures are a CLJ-only feature. This is here for compilation of CLJC without issues.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |