You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to implement a factory call stack that can be displayed in the error message that is raised from factory's after callback.
Factories can be deeply nested into one another and when the error message is displayed, it is hard to track down the path that led to the error because only the top-level factory is displayed in the message, and stack trace does not include nested factories.
Desired solution
Add ActiveSupport::Notifications.instrument("factory_bot.before_factory_run", instrumentation_payload) to factory_runner.rb before L28
Alternatives considered
Using Global callbacks, however, I cannot find a way to get the factory name from within the callback.
Using factory_bot.compile_factory event instead. Works only when running a single spec, with multiple specs, the compiled factories are cached and the event is no longer invoked.
The text was updated successfully, but these errors were encountered:
Problem this feature will solve
I need to implement a factory call stack that can be displayed in the error message that is raised from factory's
after
callback.Factories can be deeply nested into one another and when the error message is displayed, it is hard to track down the path that led to the error because only the top-level factory is displayed in the message, and stack trace does not include nested factories.
Desired solution
Add
ActiveSupport::Notifications.instrument("factory_bot.before_factory_run", instrumentation_payload)
to factory_runner.rb before L28Alternatives considered
Using Global callbacks, however, I cannot find a way to get the factory name from within the callback.
Using
factory_bot.compile_factory
event instead. Works only when running a single spec, with multiple specs, the compiled factories are cached and the event is no longer invoked.The text was updated successfully, but these errors were encountered: