Skip to content

Renamed migration file causes false positive coverage drop

Related to #370640 (closed) and !105695 (merged).

Upon squashing migrations, we rename the original init file to follow the version we're squashing to. Simplecov detects this as a drop in coverage, despite the fact that this migration never had test coverage, and new regular migrations do not require test coverage.

There are two of the best ways I can think of to approach this:

  1. Write a spec for the init_schema migration. I feel like this approach would be harder to maintain, as we would have to also rename the spec while renaming the init_schema migration. Also I feel that it's fixing an edge case with implicit behavior.
  2. Add an explicit exception in spec/simplecov_env.rb config file. I believe this would at least make the edge case known and there will be no further issues with future migration squashes.