What are y'all using for test coverage?

I’ve been using nyc with ReScriptTest and it was working well in CommonJS.

I tried to convert a project today to ES6 in Node.js, and everything went well until I hit coverage; apparently some plugin used to load modules for nyc broke in Node 14, and import specifiers are still in flux, so it’s hard for library writers to solidfy how to get coverage for .mjs files.

What are y’all using? Jest/Ava?

Disclaimer: I haven’t used this, but aantron is a solid dev and maintainer, so check out https://github.com/aantron/bisect_ppx

1 Like

I use jest with wallaby that are running on the output js files. It’s a little bit inconvenient, but better than nothing.

Rad, thanks y’all! Appreciate it. I tried bisect_ppx, but she did nothing, threw no errors, and no amount of configuration could make it generate a coverage folder. I reckon it’s only made for Jest, not Mocha. I’ll have to spend more time in the source code to see if there’s something obvious I’m missing, or just wait for the nyc kids to figure out how to make coverage work in .mjs.

bisect_ppx is fantastic. It works really well in any test runner, you just need to dump the instrumentation yourself into .coverage files after running all the tests. (See the write_coverage_data or write_coverage_data if you want to write to the file yourself). In my opinion it’s already a big step to look at the coverage report in ReScript syntax to see what doesn’t have coverage. So if you run coverage reporting on the compiled sources it’s not really useful anymore because you have to map the JS line to a ReScript line in your head. That’s just too much to ask for in a team IMO.

1 Like

I’m just running jest on the compiled JS files for coverage.