It currently inherits from Exception, so that a bare rescue => e doesn't unintentionally rescue it. We've already run into a real-world case where that proved useful, where a fork of the not_nil! implementation made it derive from StandardError, which indeed hid a test failure (only detected because we switched that copy of the code to use Type Toolkit).
To make it truly uncatchable, we can do something like throw Object.new. In a production app, this would crash your Rails app with UncaughtThrowError, so we'd have to limit it to tests. But we also don't want to crash minitest/RSpec, so we'd need to wrap the test runner in a catch call. We would need some kind of secret-ish tag to throw, that only the test runner can catch.
It currently inherits from
Exception, so that a barerescue => edoesn't unintentionally rescue it. We've already run into a real-world case where that proved useful, where a fork of thenot_nil!implementation made it derive fromStandardError, which indeed hid a test failure (only detected because we switched that copy of the code to use Type Toolkit).To make it truly uncatchable, we can do something like
throw Object.new. In a production app, this would crash your Rails app withUncaughtThrowError, so we'd have to limit it to tests. But we also don't want to crash minitest/RSpec, so we'd need to wrap the test runner in acatchcall. We would need some kind of secret-ish tag to throw, that only the test runner can catch.