JonasJurczok / factorio-todo-list

A distributed todo list mod for Factorio
MIT License
35 stars 21 forks source link

question about the spec folder #191

Open Anders142536 opened 1 year ago

Anders142536 commented 1 year ago

hey, I was browsing through your code and was curious about the spec folder. What does it do? It seems like some kind of testing code.

I am the author of a Factorio mod myself, but never touched lua outside of that. If you have a way of writing automated tests for your mod code I would like to know more about it.

JonasJurczok commented 1 year ago

Hello :)

yes, that is test code. I had the same problem when I started todo list years ago. As there was nothing back then I created Faketorio. However I kinda stopped playing after that so the project is very barebones at the moment.

The basic idea is that all code should be tested. For pure logic this can be achieved with unit tests. However everything that runs inside the game logic needs the actual game.

Faketorio packages itself with your mod as a factorio mod and gives you certain callbacks at runtime to interact with tests. This gives you the possibility to run automatic tests within the real game.

While really nice in theory it has the problem of not working headless and in a CI server.

Feel free to ask more questions as they come up :)