$ the-wire · showcase
ExUnit restores async modules in reverse, OptionParser raises the wrong error
By RepoJournal · Filed · About Elixir & Phoenix · Composed from the cited sources · methodology
Two fixes landed in elixir-lang/elixir: ExUnit's --repeat-until-failure runner now restores async modules in execution order, and OptionParser.parse!/2 and parse_head!/2 report proper ParseErrors for list switch types instead of leaking ArgumentError.
The ExUnit.Server.restore_modules/2 path used by --repeat-until-failure reconstructed the internal queue and group state using the opposite ordering from the runner, which stores modules in execution order. The runner restores async modules after each successful run, so the mismatch shuffled module order between runs; the fix preserves the execution order the runner already stores [1].
OptionParser.parse!/2 and OptionParser.parse_head!/2 raised the wrong error class when reporting invalid or missing arguments with valid list type opts. For a strict [port: [:integer, :keep]] spec, `OptionParser.parse!(["--port", "4000", "--port"], opts)` produced `** (ArgumentError) cannot convert the given list to a string` instead of `** (OptionParser.ParseError) 1 error found!` with `--port : Missing argument of type integer`. The commit fixes the reporting path for list switch types [2][3].
Both changes are in elixir-lang/elixir. The OptionParser fix is the one that affects error handling you may match on; a ParseError replacing an ArgumentError is a behavior change for callers that rescue specifically.
Action items
- → Watch for the OptionParser ParseError fix if you rescue ArgumentError around parse!/2 or parse_head!/2 elixir-lang/elixir [monitor]
- → Re-check async module ordering under --repeat-until-failure after updating ExUnit elixir-lang/elixir [monitor]
References
- [1] Preserve async module order across repeat-until-failure runs ↗ elixir-lang/elixir
- [2] Fix OptionParser wrong errors for list switch types (#15881) ↗ elixir-lang/elixir
- [3] Fix OptionParser wrong errors for list switch types ↗ elixir-lang/elixir