Reading all this nice stuff about TDD. Using the Espruino GUI suddenly feels limiting. It’s great for testing and small things less than 1000 lines, but once you want modules and testing, it fails as it’s simply not made for that.
But there’s a fix, at least for me: https://github.com/haraldkubota/esp32
In short:
- browserify to make a single JavaScipt file out of modules
- Jest for testing
- make to bundle it all together (ok, I do use npm too, but make it nicer IMHO)
- netcat to upload the code
The sparkline as well as the circular buffer code it uses was attempted to be written via TDD. I think I failed partially here, but I still have plenty tests. When restructuring the code I was happy about the tests as they confirmed all is still working! Hooray for tests!