Elixir 1.7 has been released. Elixir builds on top of Erlang designed for building scalable and maintainable applications. This release is focused on improving error handling, logger reporting, and documentation. It also brings improvements to ExUnit, Elixir’s testing library.
ExUnit is Elixir’s unit testing library. ExUnit uses Elixir macros to provide error reports when a failure happens using the assert macro. The assert macro can look at the code, extract the current line, extract the operands and show a difference between the data structures alongside the stacktrace when the assertion fails.
However, for certain ‘bare’ assertions, ExUnit usually re-runs the tests, debugging or printing the values. In Elixir 1.7, now, whenever a “bare” assertion will fail, it will print the value of each argument individually.
E.g, For a simple example such as assert some_vars(1 + 2, 3 + 4), users will get this report:
Their build tool Mix has also received new updates.
- There is a new –failed flag that runs all tests that failed the last time they ran.
- The coverage reports generated with mix test –cover includes a summary out of the box.
Updates to the ExDoc tool
ExDoc is a tool to generate documentation for user Elixir projects. It leverages metadata to provide better documentation for developers. These are the updates to ExDoc.
- Deprecated modules, functions, callbacks, and types now have a warning automatically attached to them.
- Functions, macros, callbacks, and types now include the version in which they were added.
- Future Elixir versions will include their own section for guards in the documentation and in the sidebar. They are currently exploring ways to generalize this feature in ExDoc itself.
Erlang/OTP logger integration improvements
Elixir 1.7 fully integrates with the new :logger module available in Erlang/OTP 21. The Logger.Translator mechanism has also been improved to export metadata, allowing custom Logger backends to leverage information such as:
- :crash_reason, a two-element tuple with the throw/error/exit reason as the first argument and the stacktrace as the second.
- :initial_call, the initial call that started the process.
- :registered_name, the process’ registered name as an atom.
Updates to Logger configuration system
From Elixir 1.7 the Logger macros such as debug, info, will evaluate their arguments only when the message is logged. The Logger configuration system also accepts a new option: compile_time_purge_matching that allows users to remove log calls with specific compile-time metadata.
There are also certain developments in areas not directly related to the Elixir codebase. A new Development section has been added to the website, that outlines the Elixir team structure and goals. It also now has its own mini-documentary.