2016-12-27 2 views
12

、私はElixirミックステスト出力をもっと冗長にするにはどうすればいいですか?私エリクシール/フェニックスアプリで

mix test 

を実行したときに、私はのような出力が得られます。成功した各テストのドットを

$ mix test 
.... 

Finished in 0.09 seconds 
4 tests, 0 failures 

代わりに正常に実行されたテストの名前を出力するにはどうすればよいですか?私はのように見えたディレクトリ内のファイル.rspecでこれを行うために使用されるRSpecのとRailsでは

$ cat .rspec 
--color 
-fd 
--tty 

はエリクシルの等価はありますか? https://hexdocs.pm/mix/Mix.Tasks.Test.html

希望に役立ちます:

答えて

18

合格テストの名前を印刷するには、--trace引数をmix testに渡すことができます。あなたはまた、test_helper.exsExUnit.startラインを変更することで、デフォルトでこのオプションをtrueに設定することができます

$ mix test --trace 

HTTPoisonTest 
Starting HTTParrot on port 8080 
Starting HTTParrot on port 8433 (SSL) 
Starting HTTParrot on unix socket httparrot.sock 
    * test post binary body (97.1ms) 
    * test https scheme (57.8ms) 
    * test option follow redirect relative url (4.0ms) 
    * test option follow redirect absolute url (2.6ms) 
    * test put (0.6ms) 
    * test request headers as a map (0.5ms) 
    * test get (1.5ms) 
    * test head (0.5ms) 
    * test delete (1.5ms) 
    * test asynchronous redirected get request (2.3ms) 
    * test send cookies (4.9ms) 
    * test post charlist body (0.7ms) 
    * test patch (0.5ms) 
    * test post form data (0.6ms) 
    * test exception (6.0ms) 
    * test get with params (2.8ms) 
    * test asynchronous request (0.5ms) 
    * test explicit http scheme (0.5ms) 
    * test put without body (0.8ms) 
    * test multipart upload (8.5ms) 
    * test options (0.5ms) 
    * test basic_auth hackney option (1.6ms) 
    * test http+unix scheme (4.4ms) 
    * test asynchronous request with explicit streaming using [async: :once] (304.1ms) 
    * test cached request (2.1ms) 
    * test post streaming body (3.8ms) 
    * test char list URL (0.7ms) 

HTTPoisonBaseTest 
    * test request body using ExampleDefp (124.1ms) 
    * test passing ssl option (110.9ms) 
    * test passing connect_timeout option (109.9ms) 
    * test passing recv_timeout option (103.4ms) 
    * test passing proxy option (106.6ms) 
    * test passing follow_redirect option (105.3ms) 
    * test passing proxy option with proxy_auth (106.9ms) 
    * test request raises error tuple (104.9ms) 
    * test passing max_redirect option (115.6ms) 
    * test request body using Example (111.6ms) 


Finished in 2.0 seconds 
37 tests, 0 failures 

Randomized with seed 264353 

ExUnit.start(trace: true) 

たとえば、ここhttpoisonパッケージの現在のマスターブランチにmix test --traceの出力です完全なカスタム出力が必要な場合は、独自のフォーマッタを実装できます(例としてhttps://github.com/elixir-lang/elixir/blob/master/lib/ex_unit/lib/ex_unit/cli_formatter.ex、これがデフォルトフォーマッタです)。

ExUnit.start(formatters: [YourFormatterModule]) 
2

--traceは、あなたが探しているオプションです!

関連する問題