Released 2024-11-26
.
- Add
defexpect
andexpecting
tolazytest.extensions.expectations
. Reduce code generated byexpectations/expect
, pass metadata through all generated code to make line numbers match correctly.
- Add
splint
to CI.
Released 2024-11-21
.
around
context macro is now called once for all children. (See #12.)- Update Expectations v2 port to allow for easier updating in the future and support all non-test definition functions/macros. (See #10 and #11.)
- Added .editorconfig
Released 2024-11-19
.
- Can now pass in paths as cli arguments, not just through repeated
--dir
flags:clojure -M:dev:test test/unit test/integration
will look for tests in bothtest/unit
andtest/integration
. - Documentation in
docs/core.md
and in thelazytest.core
docstring. - Exclude
lazytest.core/defdescribe
from:clojure-lsp/unused-public-var
linter.
- Removed Malli dependency as it's no longer used.
- Support doc tests where the expected value is a function:
(+ 1 1)
=> int?
is rewritten as (expect (int? (+ 1 1)))
.
- Give
lazytest.core/throws-with-msg?
andlazytest.core/causes-with-msg?
better errors when the class matches but the regex doesn't. - Switch from
:test
metadata to:lazytest/test
metadata. It's longer, but it no longer clashes withclojure.test
's internals so you can run lazytest overclojure.test
tests without them being marked as passing tests. (See #4.) - Clarify
:output
and:reporter
::output
is from the CLI or from a caller of thelazytest.repl
functions, and:reporter
is the function created/referenced from:output
. - Move namespace filtering to
lazytest.filter/filter-tree
and out oflazytest.main
.
- cljdoc links in README.md. (See #1.)
Released 2024-10-21
.
- Add support for Expectations v2 in
lazytest.extensions.expectations
. Only ports overexpect
and related helpers. - Add rudimentary test-doc support, which allows for specifying markdown files to parse and treat as tests for the purposes of test runs.
--md FILE
is how to specify markdown files to parse and treat as Lazytest tests.
Released 2024-10-15
.
Wrote better documentation for lazytest.core
, highlighting the primary vars and their use cases.
Added generic support for skipping test cases or suites with :skip
metadata.
(describe "many cases"
(it "will be skipped"
{:skip true}
(expect (= 1 2)))
(it "will be ran"
(expect (= 1 1))))
lazytest.runner/run-test-suite
: For running a suite value instead of running a namespace or a var.lazytest.core/update-children
: An intended-for-internal-use function useful in defining suites and test-cases.- Support
:skip
metadata on suites and test-cases.
lazytest.core/it
andlazytest.core/expect-it
returnnil
if within*context*
.lazytest.experimental.interfaces.midje/fact
no longer wrapsit
in adescribe
.lazytest.core/defdescribe
ignores*context*
, allowing it to be nested.
Released 2024-10-09
.
- Added the
lazytest.core
aliases to the readme. - Added a note about the experimental to the readme.
- Hide some of the helper functions from the docs.
Released 2024-10-09
.
- Add 4 "interfaces", namespaces of alternative top-level vars to define test suites and test cases:
clojure.test
,Midje
,QUnit
, andxUnit
. This allows for writing tests in a more comfortable API while still using Lazytest's machinery. See each namespace's docstring for further details. - Add popular aliases for
lazytest.core
vars:describe
->context
it
->specify
expect
->should
- Change documentation from
:lazytest/suite
to:lazytest/ns-suite
for namespace-defined suites. - Clean up reporters checking types instead of
:type
.
Released 2024-10-03
.
- Rewrite internals to use nested maps instead of nested sequences and functions. Suites (and
:lazytest/run
s and:lazytest/ns
es) have:children
, which can be other suites or test cases. - Deprecated
given
in favor oflet
.
- Add macros
before
andafter
, and support:context
in suite metadata. This allows for writing fixture-like code that can be reused across multiple suites or tests:
(defdescribe context-test
(let [state (volatile! [])]
(describe "it runs both"
{:context [(before (vswap! state conj :before))
(after (vswap! state conj :after))]}
(expect-it "temp" true))
(expect-it "tracks correctly"
(= [:before :after] @state))))
- Add the macro
around
, which works like aclojure.test
fixture:
(describe "it works"
{:context [(around [f]
(binding [*foo* 100]
(f)))]}
...)
-
Add macros
before-each
andafter-each
, which are run before/after each nested test case. -
Add function
set-ns-context!
which sets the current namespace's context to be the given vector. Works likeclojure.test/use-fixture
.
- Changed primary branch from
master
tomain
. - Disconnected Github fork from original Lazytest repo.
Released 2024-09-20
.
--watch
cli flag will run under "Watch mode", which uses clj-reload to check for changes in local classpath, and then reruns the provided or default test suite. Includes--delay NUM
which allows for changing the number of milliseconds between checking changes.
Released 2024-08-28
.
- Target java 11 as unnecessary to target later versions.
Released 2024-08-28
.
- Merge metadata on
defdescribe
var intodescribe
attr-map. Fixes--include
and--exclude
filtering on var metadata instead of attr-map.
Released 2024-08-19
.
-n
,--namespace NS
cli flag to specify namespaces that will be tested.-v
,--var VAR
cli flag to specify vars that will be tested.- Support
:test
metadata on vars. Handles functions, test cases, and test suites, converting them to test suites or using them directly. They're treated in the reporter as test vars, using the defn's var. (See README.md for examples.)
Released 2024-08-08
.
--exclude
and--include
cli flags for metadata selection.--include
works like^:focus
but is arbitrary metadata.
- Added "Usage" to README, listing cli options.
- Print correct version in
--help
output.
Released 2024-06-26
.
- Cleaned up README, added Editor Integration section.
Released 2024-06-18
.
- Rename test-case-result keys to match clojure.test and other test language's runners:
:form
->:expected
:result
->:actual
- Collapse
:fail
and:error
into:fail
. If reporters want to differentiate, they can by checking if:thrown
is anExpectationFailed
. (Seeclojure-test
reporter for an example.) - Add
(message, reason)
constructor arity to ExpectationFailed to better match bothAssertionError
andExceptionInfo
. - Catch ExpectationFailed in
expect
, rethrow with updated:message
, instead of passingmsg
into each assert-expr like in clojure.test. - Catch other Throwables in
expect
, wrap in ExpectationFailed as:caught
data. - Simplify how
:message
s are tracked. - Require a docstring expression from
describe
,it
andexpect-it
. - Add
*color*
dynamic var (set to lazytest.colorize system env, default to true) and makecolorize?
rely on it. - Move all relevant test case information into result object.
- Move all relevant suite information into result object.
- Filter suites/test cases when running a single var.
- Add support for nubank/matcher-combinators.
- Sort test vars by line and column before running.
- Rewrite runner to use type-based multimethod with report hooks.
- Rewrite reporters to use new report hooks, allow for multiple hooks to be combined:
focused
prints if there's any focused tests.summary
prints "Ran x test cases, N failures, Y errors".results
prints failed and errored test cases, expected values, etc.dots
prints.
for passing test case, andF
for failure. Namespaces wrap test cases in parentheses:(..F.)
Includesfocused
,results
, andsummary
.nested
prints each suite and test case on a new line, and indents each suite. Includesfocused
,results
, andsummary
.clojure-test
attempts to mimic clojure.test's basic output.debug
prints "Running X" and "Done with X" for all test sequences and print the direct result of all test cases.
- Add tests for reporters.
Released 2024-06-09
.
Updated original code to use deps.edn, tools.build, and other modern tooling.
- Remove all maven-specific and leiningen-specific code.
- Remove
clojure.test
-like api. - Remove random sampling code.
- Remove dependency-tracking and reloading and autotest code.
- Remove clojure 1.3 test code examples.
- Add CLI api.
- Change external API to use a single namespace (
lazytest.core
). - Change external API macros and functions to work better with modern tooling (use vars, etc).