Copy busted's mock, stub and spy API
danielbrauer opened this issue · 6 comments
The mocking in faketorio is useful, but it would be awesome if I could use the same API as in my busted tests: https://olivinelabs.com/busted/#spies-mocks-stubs
Yeah..
Originally I wanted to use the real busted mocking in faketorio. But this would require to copy a lot more dependencies into the mod. So I opted to create my own mocking framework. I come from the Java world so I adapted the syntax a little bit.
But yes, cloning the busted syntax might be a good idea :)
So far I haven't met a use case to use stubs and spys inside of faketorio, hence there is no support for them at the moment :)
I think it would be fine to have busted as a dependency
I'm not worried about busted itself but about it's dependencies :)
The problem is that everything that we need has do be copied into the mod. Otherwise it won't be available inside of factorio.
So faketorio is copied into the mod. If we now add busted we also have to copy busted itself. For busted to work correctly we have to also copy all of busteds dependencies and maintain that list if it should change at some point.
This decision has a long tail :)
Ah yeah, I just read up on how you can't include external libraries in Factorio.
Would it be possible to automatically get the dependencies using luarocks?
In theory yes.. but the complexity just increases :)