Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid test module state in exunit event #13373

Closed
lukaszsamson opened this issue Feb 27, 2024 · 0 comments
Closed

Invalid test module state in exunit event #13373

lukaszsamson opened this issue Feb 27, 2024 · 0 comments

Comments

@lukaszsamson
Copy link
Contributor

Elixir and Erlang/OTP versions

Erlang/OTP 25 [erts-13.2.2.6] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1]

Elixir 1.16.1 (compiled with Erlang/OTP 25)

Operating system

macOS

Current behavior

In an exunit formatter when setup_all is killed
e.g.

setup_all %{} do
    Process.exit(self(), :killed)
end

the formatter receives events with invalid state

{:test_finished, test = %ExUnit.Test{state: {:invalid, test_module = %ExUnit.TestModule{state: nil}}}}

https://hexdocs.pm/ex_unit/ExUnit.TestModule.html points to https://hexdocs.pm/ex_unit/ExUnit.html#t:state/0 and there nil is ether not started or passed state.

This makes it difficult to print the failure reason for a particular test.

Note: module_finished event emitted later has correct state

Expected behavior

I expect the test module to have :failed state

test_module = %ExUnit.TestModule{state: {:failed, failures}}
lukaszsamson added a commit to elixir-lsp/elixir-ls that referenced this issue Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant