diff --git a/CHANGELOG.md b/CHANGELOG.md index f4893e9..e2bb05e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ - Changed dark blue in reporter to light blue - Highlight errors headline in error list reporter - Highlight test method in backtraces +- Use Colorize::ColorRGB for better colors +- Fix deprecated `splat/double_splat` ### 1.2.6 diff --git a/README.md b/README.md index 612ffa2..61d8601 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 🔬 microtest [![Crystal CI](https://github.com/Ragmaanir/microtest/actions/workflows/crystal.yml/badge.svg)](https://github.com/Ragmaanir/microtest/actions/workflows/crystal.yml) -### Version 1.2.6 +### Version 1.2.7 A small testing framework inspired by minitest/minitest.cr. @@ -26,7 +26,7 @@ Add this to your application's `shard.yml`: development_dependencies: microtest: github: ragmaanir/microtest - version: ~> 1.2.6 + version: ~> 1.2.7 ``` And add this to your `spec_helper.rb`: diff --git a/assets/assertion_failure.html b/assets/assertion_failure.html index c2b270f..58ad0f1 100644 --- a/assets/assertion_failure.html +++ b/assets/assertion_failure.html @@ -8,9 +8,9 @@
-# 1 AssertionFailureTest#assertion_failure SPEC: spec/test.cr:5 -┏ assert ("a" * a) == b -┗ "aaaaa" == "aaaaaa" +# 1 AssertionFailureTest#assertion_failure SPEC: spec/test.cr:5 +┏ assert ("a" * a) == b +┗ "aaaaa" == "aaaaaa" diff --git a/assets/assertion_failure.jpg b/assets/assertion_failure.jpg index 3bbc61a..738a997 100644 Binary files a/assets/assertion_failure.jpg and b/assets/assertion_failure.jpg differ diff --git a/assets/description_reporter.html b/assets/description_reporter.html index e4dcc7d..305277b 100644 --- a/assets/description_reporter.html +++ b/assets/description_reporter.html @@ -9,44 +9,43 @@-FirstTest - ✓ 174 ns success - ✓ 17 µs skip this +FirstTest + ✓ 202 ns success + ✓ 19 µs skip this -SecondTest - ✕ 14 µs first failure - ✕ 7 µs error +SecondTest + ✕ 20 µs first failure + ✕ 7 µs error -skip_this: not implemented in SPEC: spec/test.cr:5 +skip_this: not implemented in SPEC: spec/test.cr:5 -# 1 SecondTest#first_failure SPEC: spec/test.cr:5 -┏ assert a == (b * 2) -┗ 5 == 14 +# 1 SecondTest#first_failure SPEC: spec/test.cr:5 +┏ assert a == (b * 2) +┗ 5 == 14 -# 2 SecondTest#error +# 2 SecondTest#error SPEC: spec/test.cr:5 Oh, this is wrong -┏ CRY: /crystal/main.cr:141 main -┃ CRY: /crystal/main.cr:115 main -┃ CRY: /crystal/main.cr:129 main_user_code -┃ SPEC: spec/test.cr:7 __crystal_main -┃ APP: src/microtest.cr:109 run! -┃ APP: src/microtest.cr:98 run -┃ APP: src/microtest.cr:100 run -┃ APP: src/microtest/runner.cr:26 call -┃ APP: src/microtest/test.cr:37 run_tests -┃ APP: src/microtest/test_method.cr:27 call -┃ SPEC: spec/test.cr:5 -> -┃ APP: src/microtest/test.cr:52 run_test -┃ APP: src/microtest/test.cr:83 around_hooks -┃ APP: src/microtest/test.cr:56 -> -┃ SPEC: spec/test.cr:5 -> -┃ SPEC: spec/test.cr:5 test__error -┗ SPEC: spec/test.cr:5 raise_an_error - - -Executed 4/4 tests in 188µs with seed 1 -Success: 1, Skips: 1, Failures: 2 +┏ CRY: /crystal/main.cr:141 main +┃ CRY: /crystal/main.cr:115 main +┃ CRY: /crystal/main.cr:129 main_user_code +┃ APP: src/microtest.cr:108 run! +┃ APP: src/microtest.cr:97 run +┃ APP: src/microtest.cr:99 run +┃ APP: src/microtest/runner.cr:26 call +┃ APP: src/microtest/test.cr:37 run_tests +┃ APP: src/microtest/test_method.cr:29 call +┃ SPEC: spec/test.cr:5 -> +┃ APP: src/microtest/test.cr:52 run_test +┃ APP: src/microtest/test.cr:83 around_hooks +┃ APP: src/microtest/test.cr:56 -> +┃ SPEC: spec/test.cr:5 -> +┃ SPEC: spec/test.cr:5 test__error +┗ SPEC: spec/test.cr:5 raise_an_error + + +Executed 4/4 tests in 200µs with seed 1 +Success: 1, Skips: 1, Failures: 2diff --git a/assets/description_reporter.jpg b/assets/description_reporter.jpg index 66f4bc2..8d606f1 100644 Binary files a/assets/description_reporter.jpg and b/assets/description_reporter.jpg differ diff --git a/assets/focus.html b/assets/focus.html index 9c858f9..c249df7 100644 --- a/assets/focus.html +++ b/assets/focus.html @@ -9,12 +9,12 @@-FocusTest - ✓ 190 ns focused - ✓ 102 ns focused too +FocusTest + ✓ 335 ns focused + ✓ 144 ns focused too -USING FOCUS: Executed 2/3 tests in 116µs with seed 1 -Success: 2, Skips: 0, Failures: 0 +USING FOCUS: Executed 2/3 tests in 171µs with seed 1 +Success: 2, Skips: 0, Failures: 0diff --git a/assets/focus.jpg b/assets/focus.jpg index 7848279..7cb7045 100644 Binary files a/assets/focus.jpg and b/assets/focus.jpg differ diff --git a/assets/progress_reporter.html b/assets/progress_reporter.html index cba8b8d..0d7adc9 100644 --- a/assets/progress_reporter.html +++ b/assets/progress_reporter.html @@ -8,38 +8,38 @@-•••• +•••• -skip_this: not implemented in SPEC: spec/test.cr:5 +skip_this: not implemented in SPEC: spec/test.cr:5 -# 1 SecondTest#first_failure SPEC: spec/test.cr:5 -┏ assert a == (b * 2) -┗ 5 == 14 +# 1 SecondTest#first_failure SPEC: spec/test.cr:5 +┏ assert a == (b * 2) +┗ 5 == 14 -# 2 SecondTest#error +# 2 SecondTest#error SPEC: spec/test.cr:5 Oh, this is wrong -┏ CRY: /crystal/main.cr:141 main -┃ CRY: /crystal/main.cr:115 main -┃ CRY: /crystal/main.cr:129 main_user_code -┃ SPEC: spec/test.cr:7 __crystal_main -┃ APP: src/microtest.cr:109 run! -┃ APP: src/microtest.cr:98 run -┃ APP: src/microtest.cr:100 run -┃ APP: src/microtest/runner.cr:26 call -┃ APP: src/microtest/test.cr:37 run_tests -┃ APP: src/microtest/test_method.cr:27 call -┃ SPEC: spec/test.cr:5 -> -┃ APP: src/microtest/test.cr:52 run_test -┃ APP: src/microtest/test.cr:83 around_hooks -┃ APP: src/microtest/test.cr:56 -> -┃ SPEC: spec/test.cr:5 -> -┃ SPEC: spec/test.cr:5 test__error -┗ SPEC: spec/test.cr:5 raise_an_error - - -Executed 4/4 tests in 183µs with seed 1 -Success: 1, Skips: 1, Failures: 2 +┏ CRY: /crystal/main.cr:141 main +┃ CRY: /crystal/main.cr:115 main +┃ CRY: /crystal/main.cr:129 main_user_code +┃ SPEC: spec/test.cr:7 __crystal_main +┃ APP: src/microtest.cr:108 run! +┃ APP: src/microtest.cr:97 run +┃ APP: src/microtest.cr:99 run +┃ APP: src/microtest/runner.cr:26 call +┃ APP: src/microtest/test.cr:37 run_tests +┃ APP: src/microtest/test_method.cr:29 call +┃ SPEC: spec/test.cr:5 -> +┃ APP: src/microtest/test.cr:52 run_test +┃ APP: src/microtest/test.cr:83 around_hooks +┃ APP: src/microtest/test.cr:56 -> +┃ SPEC: spec/test.cr:5 -> +┃ SPEC: spec/test.cr:5 test__error +┗ SPEC: spec/test.cr:5 raise_an_error + + +Executed 4/4 tests in 209µs with seed 1 +Success: 1, Skips: 1, Failures: 2diff --git a/assets/progress_reporter.jpg b/assets/progress_reporter.jpg index 838dd7f..f3908d0 100644 Binary files a/assets/progress_reporter.jpg and b/assets/progress_reporter.jpg differ diff --git a/assets/spec.html b/assets/spec.html index 8ba0915..b7ececc 100644 --- a/assets/spec.html +++ b/assets/spec.html @@ -8,16 +8,16 @@-••••••••••••••••••••••••••••••••••••••••••••••••••••••• +••••••••••••••••••••••••••••••••••••••••••••••••••••••• -Slowest 3 tests +Slowest 3 tests - ✓ 4 s FocusExampleTest#image - ✓ 4 s SummaryAndProgressRepoterExampleTest#image - ✓ 3 s AssertionFailureExampleTest#assertion_failure_example + ✓ 5 s FocusExampleTest#image + ✓ 4 s AssertionFailureExampleTest#assertion_failure_example + ✓ 4 s SummaryAndProgressRepoterExampleTest#image -Executed 55/55 tests in 1m with seed 270051453 -Success: 55, Skips: 0, Failures: 0 +Executed 55/55 tests in 1m with seed 1113618552 +Success: 55, Skips: 0, Failures: 0diff --git a/assets/spec.jpg b/assets/spec.jpg index 2a83463..777a02b 100644 Binary files a/assets/spec.jpg and b/assets/spec.jpg differ diff --git a/shard.yml b/shard.yml index 35297b3..f31cfd3 100644 --- a/shard.yml +++ b/shard.yml @@ -1,5 +1,5 @@ name: microtest -version: 1.2.6 +version: 1.2.7 crystal: '>= 1.4.0' license: MIT diff --git a/src/microtest.cr b/src/microtest.cr index 8ac6255..08d1e72 100644 --- a/src/microtest.cr +++ b/src/microtest.cr @@ -11,7 +11,6 @@ require "./microtest/test" require "./microtest/runner" require "./microtest/reporter" require "./microtest/reporters" -require "./microtest/json_reporter" module Microtest module DSL diff --git a/src/microtest/cli.cr b/src/microtest/cli.cr index 3aa05b2..38e64ea 100644 --- a/src/microtest/cli.cr +++ b/src/microtest/cli.cr @@ -71,7 +71,7 @@ class ReleaseCommand run("git", ["push", "gh", version_name]) end - def self.confirm(msg : String) + def confirm(msg : String) print "❓ #{msg} [y/n/yes/no]: " while a = gets.not_nil!.strip.downcase diff --git a/src/microtest/json_reporter.cr b/src/microtest/reporters/json_reporter.cr similarity index 98% rename from src/microtest/json_reporter.cr rename to src/microtest/reporters/json_reporter.cr index 495bbc1..2031080 100644 --- a/src/microtest/json_reporter.cr +++ b/src/microtest/reporters/json_reporter.cr @@ -1,7 +1,5 @@ require "json" -require "./formatter" - module Microtest class JsonSummaryReporter < Reporter def report(result : TestResult)