mix_eunit v0.3.0 Mix.Tasks.Eunit

Run eunit tests for a project.

This task compiles the project and its tests in the test environment, then runs eunit tests. This task works recursively in umbrella projects.

Command line options

A list of patterns to match for test files can be supplied:

mix eunit foo* bar*

The runner automatically adds “.erl” to the patterns.

The following command line switches are also available:

  • --verbose, -v - run eunit with the :verbose option
  • --cover, -c - create a coverage report after running the tests
  • --profile, -p - show a list of the 10 slowest tests
  • --start - start applications after compilation
  • --no-color - disable color output
  • --force - force compilation regardless of compilation times
  • --no-compile - do not compile even if files require compilation
  • --no-archives-check - do not check archives
  • --no-deps-check - do not check dependencies
  • --no-elixir-version-check - do not check Elixir version

The verbose, cover, profile, start and color switches can be set in the mix.exs file and will apply to every invocation of this task. Switches set on the command line will override any settings in the mixfile.

def project do
  [
    # ...
    eunit: [
      verbose: false,
      cover: true,
      profile: true,
      start: true,
      color: false
    ]
  ]
end

Test search path

All “.erl” files in the src and test directories are considered.

Summary

Functions

A task needs to implement run which receives a list of command line args

Functions

run(args)

A task needs to implement run which receives a list of command line args.

Callback implementation for Mix.Task.run/1.