thoughtbot / fishery

A library for setting up JavaScript objects as test data
MIT License
877 stars 36 forks source link

Handle onCreate hook chaining and promise rejections properly #46

Closed siquel closed 3 years ago

siquel commented 3 years ago

Simplified version of #45

Both of the tests fail if the promises are discarded as @ObliviousHarmony spotted out in the comments.

stevehanson commented 3 years ago

Just to follow up, I found that CI was failing after merging this to master. The issue was that calling factory.onCreate was actually modifying the original factory in addition to returning a new factory. The result was that the test execution order affected the test results. I put in a fix for this in #47 and just released Fishery version 1.2.0.

vpillinger commented 3 years ago

@stevehanson Thanks for fixing that! I noticed that issue but thought it was intentional behavior so I adjusted the test cases locally to use beforeEach.

Overall, fixing the core issue is a much better solution.