evnu / docception

Run Elixir doctests on arbitrary markdown files
Apache License 2.0
6 stars 2 forks source link

Improve output in successful case #9

Closed axelson closed 3 years ago

axelson commented 3 years ago

This PR makes two changes to improve the output in the successful case (the failure case is unchanged):

  1. Print out the number of successful tests
  2. Disable the default ExUnit.CLIFormatter

Without this change:

$ MIX_ENV=test mix docception README.md
Docception: README.md

Finished in 0.05 seconds (0.05s on load, 0.00s on tests)
0 failures

With this change:

$ MIX_ENV=test mix docception README.md
Docception: README.md
3 doctests passed

I think this is an improvement because the ExUnit.CLIFormatter output was incorrect because we're not actually running any ExUnit tests. And the timings appear to be incorrect as well (I tested by putting a Process.sleep(1_000) in a test and it was counted as part of the load time), also I also think that generally tests run in a markdown file will be fast.

I think the number of passing tests is important to include to more easily check that all your markdown tests are running.

evnu commented 3 years ago

Looks good, thanks! You don't know how happy I am that somebody is actually using this! :) Seems that I can mark one more TODO in the README as done.

axelson commented 3 years ago

Thanks for merging! And I'm glad you can mark that off on the TODO list :confetti_ball: