You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
devtools::test_coverage_active_file() and devtools::test() disagree on the error message to snapshot #2698
This is related to how covr works. Hopefully this helps someone.
Why do snapshot messages change?
When covr runs, it doesn't run tests right away but it instruments the functions in the package first. This means that it inserts pieces of code to count the number of times a line of code is run during the tests. For instance, this piece of code:
if (x) {}
would become this:
if (if (TRUE) {
covr:::count("...:2:7:...")
x
}) {}
Therefore, when x has length 0 then the error:
Errorin`if (x) ...`:!argumentisoflengthzero
becomes:
Errorin`if (...) NULL`:!argumentisoflengthzero
because the ... represents the block:
if (TRUE) {
covr:::count("...:2:7:...")
x
}
These are the two different messages that we see in the snapshots.
Activity
etiennebacher commentedon Jun 23, 2026
This is related to how
covrworks. Hopefully this helps someone.Why do snapshot messages change?
When
covrruns, it doesn't run tests right away but it instruments the functions in the package first. This means that it inserts pieces of code to count the number of times a line of code is run during the tests. For instance, this piece of code:would become this:
Therefore, when
xhas length 0 then the error:becomes:
because the
...represents the block:These are the two different messages that we see in the snapshots.