iTwin / itwinjs-core

Monorepo for iTwin.js Library
https://www.itwinjs.org
MIT License
620 stars 210 forks source link

Switch from istanbul to v8 for vitest coverage provider #7252

Closed hl662 closed 1 month ago

hl662 commented 1 month ago

We're seeing an increase in running times for rush cover in our CI builds, in particular the subdirectories that have moved to vitest might not exit cleanly at the end of the test run, and hang. This PR aims to reduce flakiness of rush cover by switching to a more performant coverage provider for vitest. The reported coverage statistics are different - we see 10-15% improvement to coverage statistics when switching from istanbul to v8...

Locally, on an M1 Mac, comparing times from istanbul to v8 across the 3 packages that are using vitest right now, averaged across 5 runs:

Diving deeper into the times for core-geometry, the time vitest spent transforming and setting up the tests were significantly lower (from 370s in total across parallel workers down to 79s), because istanbul uses babel to transpile, adding extra overhead to the files, compared to v8.

A side effect of this is that istanbul ignore comments won't be picked up by the coverage provider, but none were found in the affected packages.