Backport fix from master to minitest version in new Rubies.