antonmi / espec

Elixir Behaviour Driven Development
Other
808 stars 62 forks source link

Make test runner survive after process death #283

Closed Kukunin closed 5 years ago

Kukunin commented 5 years ago

Hi Anton, thanks for the great package!

There are a lot of possible reasons when the running process might die, when a linked process died, for example.

Unfortunately, the test runner doesn't survive and exits immediately. It becomes very annoying because you don't know what exactly test failed and caused the death of a whole test suite. Also, there is no way (or I'm blind) to switch for detailed reports instead of regular dots.

To reproduce you can try this:

  it do: spawn_link fn -> raise "kill" end

In practice, when Ecto raises exception about the ownership, the whole suite fails and there is no way to understand what test caused the problem.

I can try to make a PR, but want to hear from you first. Thanks

Kukunin commented 5 years ago

At least the runner process can have Process.flag(:trap_exit, true) to survive death of a linked process

antonmi commented 5 years ago

Hi, @Kukunin ! Good point! I'm looking forward to PR from you!

Kukunin commented 5 years ago

@antonmi thanks for the fast answer. Will try to make a PR =)