This namespace provides utilities for testing and mocking the Knitty system.
This namespace provides utilities for testing and mocking the Knitty system.
(explain-yank-result yank-result)
Analyzes a yank-result by extracting trace information and computing dependency graphs.
Returns a map containing keys:
Throws an exception if no traces are attached to the yank-result.
Analyzes a yank-result by extracting trace information and computing dependency graphs. Returns a map containing keys: - :ok? - Boolean indicating whether the yank succeeded. - :result - The yank result or thrown exception. - :traces - A sequence of trace records. - :yanked - A set of yanked node identifiers. - :failed - A set of node identifiers that failed. - :called - A set of computed node identifiers. - :leaked - A set of node identifiers that started but did not finish. - :use - Graph (adjacency list) of direct node usages. - :use* - Graph of transitive node usages. - :depend - Graph of direct dependencies. - :depend* - Graph of transitive dependencies. Throws an exception if no traces are attached to the yank-result.
(from-ns & nss)
Builds a keyword predicate that matches any namespace from the given specifications. Namespaces may be specified as strings, symbols, or regex patterns.
Builds a keyword predicate that matches any namespace from the given specifications. Namespaces may be specified as strings, symbols, or regex patterns.
(from-this-ns)
Builds a keyword predicate that matches keywords only from the current namespace (ns).
Builds a keyword predicate that matches keywords only from the current namespace (*ns*).
(mock-registry registry yarn-key->mock-yarn)
Creates a mock registry based on the given real registry and a mapping function.
The mock registry will use yarn-key->mock-yarn
to override yarns when present; otherwise, it
delegates to the real registry.
Creates a mock registry based on the given real registry and a mapping function. The mock registry will use `yarn-key->mock-yarn` to override yarns when present; otherwise, it delegates to the real registry.
(with-yarns yarns & body)
Runs the given body with additional yarns attached to the registry. This macro is intended for testing or mocking scenarios and is known to be slow.
Runs the given body with additional yarns attached to the registry. This macro is intended for testing or mocking scenarios and is known to be slow.
(with-yarns* yarns body-fn)
Executes the provided body function with additional yarns merged into the global registry.
Executes the provided body function with additional yarns merged into the global registry.
(with-yarns-only predicate & body)
Runs the body with some yarns deactivated based on a predicate.
The predicate is called with each yarn-id (a namespaced keyword) in the registry. If it returns false, the yarn is replaced with a 'fail always' stub.
For example, to disable all yarns except those from the current namespace:
(with-yarns-only (from-this-ns)
(do-something))
This macro is intended for testing or mocking and is known to be slow.
Runs the body with some yarns deactivated based on a predicate. The predicate is called with each yarn-id (a namespaced keyword) in the registry. If it returns false, the yarn is replaced with a 'fail always' stub. For example, to disable all yarns except those from the current namespace: (with-yarns-only (from-this-ns) (do-something)) This macro is intended for testing or mocking and is known to be slow.
(with-yarns-only* predicate body-fn)
Runs the provided body function with yarns filtered by a predicate.
For each yarn in the registry, if the predicate returns false then that yarn is disabled by replacing it with a 'fail always' stub.
Runs the provided body function with yarns filtered by a predicate. For each yarn in the registry, if the predicate returns false then that yarn is disabled by replacing it with a 'fail always' stub.
(yank-explain! inputs yarns)
(yank-explain! inputs yarns opts)
Runs kt/yank
with tracing enabled, waits synchronously for the result, and returns
additional diagnostic information for debugging and testing.
See explain-yank-result
for information about the returned value.
Runs `kt/yank` with tracing enabled, waits synchronously for the result, and returns additional diagnostic information for debugging and testing. See `explain-yank-result` for information about the returned value.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close