[Proposal] Mix test option that prints all failed test at the end

26 views
Skip to first unread message

Ivan Ivanov

unread,
Aug 6, 2019, 6:10:21 AM8/6/19
to elixir-lang-core
I propose to add an option similar to `--slowest`. If this new option is passed when the tests finish running a list of the failed tests will be printed.

For example, this is going to be useful for the project I'm currently working on. It has a lot of tests and uses the `--slowest` option in the CI(`--slowest` automatically sets `--trace`). When this is done the output of the test is very long and locating the fails requires scrolling and manually locating the failed tests. I see value in such an option even without having `--trace` enabled.

José Valim

unread,
Aug 6, 2019, 6:22:55 AM8/6/19
to elixir-l...@googlegroups.com
ExUnit supports multiple formatters so the best option to customize said behavior is by adding your own custom formatters. For example, you can have a formatter in which its only job is to print the summary at the end.

On Tue, Aug 6, 2019 at 12:10 Ivan Ivanov <ivan.iv...@gmail.com> wrote:
I propose to add an option similar to `--slowest`. If this new option is passed when the tests finish running a list of the failed tests will be printed.

For example, this is going to be useful for the project I'm currently working on. It has a lot of tests and uses the `--slowest` option in the CI(`--slowest` automatically sets `--trace`). When this is done the output of the test is very long and locating the fails requires scrolling and manually locating the failed tests. I see value in such an option even without having `--trace` enabled.

--
You received this message because you are subscribed to the Google Groups "elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/b6226e72-1a5f-49fe-a3f7-199deced0c0b%40googlegroups.com.
--


José Valim
Skype: jv.ptec
Founder and Director of R&D

Jason Axelson

unread,
Aug 7, 2019, 1:54:50 AM8/7/19
to elixir-l...@googlegroups.com
You could use this custom formatter that I created as a base: https://github.com/axelson/ex_unit_file_formatter

This will print out output like:
```
==> my_app

Failed Files:
1: /Users/jason/dev/my_app/apps/web_interface/test/controllers/internal_api/v1/page_controller_test.exs
==> parser

Failed Files:
9: /Users/jason/dev/my_app/apps/parser/test/parser_test.exs
5: /Users/jason/dev/my_app/apps/parser/test/parser_info_test.exs
1: /Users/jason/dev/my_app/apps/parser/test/file_parser_test.exs
```
So you can see how many errors were in each file. If you fork the repo it should be pretty easy to print out non-summarized information. I've found that it is really quite pleasant to create a new formatter.

-Jason

On Tue, Aug 6, 2019 at 12:10 AM Ivan Ivanov <ivan.iv...@gmail.com> wrote:
I propose to add an option similar to `--slowest`. If this new option is passed when the tests finish running a list of the failed tests will be printed.

For example, this is going to be useful for the project I'm currently working on. It has a lot of tests and uses the `--slowest` option in the CI(`--slowest` automatically sets `--trace`). When this is done the output of the test is very long and locating the fails requires scrolling and manually locating the failed tests. I see value in such an option even without having `--trace` enabled.

--
Reply all
Reply to author
Forward
0 new messages