Minitest + all the features you always wanted.
Features
- Ctrl+c stops tests and prints failures
- pastable rerun snippet for failures (disabled/integrated on rails 5)
- multiple before & after blocks
before :all
blocks- around blocks
around { |t| Dir.chdir(...) { t.call } }
- red-green output (disabled/integrated on rails 5)
mtest
executable to run by line number and by folder (disabled/integrated on rails 5)- full backtrace for errors and assertions with verbose (
-v
) let!
let_all
execute once for all tests in a class and it's subclassesorder_dependent!
to make your tests run in given orderMaxitest.static_class_order = true
no longer sort tests class/sub-classes in random ordercontext
for more expressionpending { assert false }
is skip when it fails, but fails when it passes- implicit subject via
require 'maxitest/implicit_subject'
xit
to skip test (also does not call setup or teardown)require 'maxitest/timeout'
to make hanging tests fail afterMaxitest.timeout
secondsrequire 'maxitest/threads'
fail tests that leave extra threads runningrequire 'maxitest/global_must'
(before autorun) disable deprecation on globalmust_*
or global_expectations gem
Install
gem install maxitest
Usage
require "maxitest/autorun"
... normal tests ...
Development
- everything vendored into 1 gem to avoid dependency madness
- tested via rspec to avoid messing up our own tests by accident
- fixes should go back to the original libraries
- restrictive minitest dependency so nothing breaks by accident
- ruby >=3.0
rake bundle
to update all vendored gems
Author
- running by line number from minitest-line
- around from minitest-around
- mtest from testrbl
- red-green from minitest-rg
Michael Grosser
[email protected]
License: MIT