Skip to content

mix test --warnings-as-errors and --failed flags with unexpected interaction #11484

@polvalente

Description

@polvalente

Environment

  • Elixir & Erlang/OTP versions (elixir --version):
Erlang/OTP 24 [erts-12.1.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]

Elixir 1.12.3 (compiled with Erlang/OTP 24)
  • Operating system: Ubuntu 20.04 (but issue also occurs on CI machine with Alpine 3.14.2)

Current behavior

Running mix test --warnings-as-errors || mix test --warnings-as-errors --failed can cause warnings to fall through the CI workflow.
This is because the --warnings-as-errors ends up not running any tests at all, which in turn causes the --failed flag on the second command to not return any files to be compiled, resulting in a false success.

For what is worth and future reference, the current local fix is to run it as: mix test --warnings-as-errors || if [[ $? = 1 ]]; then (exit 1); else mix test --warnings-as-errors --failed; fi

Expected behavior

In my opinion this is not desirable behaviour, and perhaps could be fixed by keeping track of a failure due to warnings, effectively marking all related files as failed for the next command.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions