JonasJurczok / faketorio

Run automatic tests for your mod inside Factorio
MIT License
19 stars 4 forks source link

Copy busted's mock, stub and spy API #76

Open danielbrauer opened 5 years ago

danielbrauer commented 5 years ago

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

JonasJurczok commented 5 years ago

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 :)

JonasJurczok commented 5 years ago

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 :)

danielbrauer commented 5 years ago

I think it would be fine to have busted as a dependency

JonasJurczok commented 5 years ago

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 :)

danielbrauer commented 5 years ago

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?

JonasJurczok commented 5 years ago

In theory yes.. but the complexity just increases :)