I might be bringing an old topic. I’m working on a test framework for ReScript called zekr, and I’ve been recently trying to add support for code coverage on it.
I was able to do it over the compiled javascript code only, but that’s not ideal. To have a coverage report over the rescript code, I need to map the coverage from JS using source maps. Since rescript doesn’t natively support it, I used a naive custom implementation I generated with AI, that I can at least map top level declarations and some conditional branches. Not very accurate, but it was goodenough for me to get a proof of concept:
Still, I wonder if there’s any plan or even motivation for investing in a source map generator. Even though the compiled js code from rescript is clean and very much human-readable, and I really don’t miss source maps while developing or debugging my rescript code, I still think the ecosystem would benefit a lot from source maps, especially when integrating applications with observability tools.
I was at a conference recently where someone gave a talk on how source maps work, and it’s really niche but not that difficult. It’s something that has been on my list of ideas to try out.
I’m interested in exploring source maps for ReScript as well, maybe we can team up for a poc. I just need to sort it out some other priorities first before diving in.