R CMD check, I often cry a little upon “Last 13 lines of output” in the log, because 13 lines is often not enough for me to figure out why tests failed. Today I was tortured by this problem again (it is particularly painful when tests only fail on Travis CI but not locally1), and could no longer stand it. I desperately wanted to see more lines of output. After some Google searches, I didn’t find an answer, so in the spirit of “Luke, use the
force source!“, I searched in the base R source (Winston’s r-source repo), and finally found this line in
tools/R/check.R. Bingo! The magic number 13 is controlled by the environment variable named
_R_CHECK_TESTS_NLINES_. Then I went to the R Internals manual, and found it had been documented there.
After I set
_R_CHECK_TESTS_NLINES_=0, I was able to see the full output (instead of the truncated version), and finally figured out what was wrong.