We have a legacy codebase which we've just started adding unit test coverage. This means that while we have a massive codebase (1.5million lines, at least 600 classes, plus support, template files), we only have one or two unit tests in the entire application. (Sad but true).
My problem is that arcanist unit testing (either with arc unit
or part of arc diff
) takes over four minutes to run. PHPUnit, on the other hand takes only seconds.
Unit tests are supposed to be short, especially if it's only on the most recent diff. How do I speed these up, or, barring that, see what arcanist is trying to do (so I can optimize myself)?
My best guess is that this has to do with the fact that arcanist needs to look for a test file, while PHPUnit does not, but in that case I don't know how to make arcanist default to the right directory.
It turns out that this is actually caused not by the testing but by the coverage. By default Arcanist tries to provide code coverage reports:
PASS 14ms★ Test\Unicorn\Feeds\Somber\DubStep::testLoadBadType
PASS 5ms★ Test\Unicorn\Feeds\Somber\DubStep::testLoadBadJSON
PASS 8ms★ Test\Unicorn\Feeds\Somber\DubStep::testLoadBadSeasonWeek
PASS 148ms Test\Unicorn\Feeds\Somber\DubStep::testEmptyData
PASS 200ms Test\Unicorn\Feeds\Somber\DubStep::testCompleteLoad
PASS 5ms★ Test\Fantasy\Feeds\Somber\DubStep::testGetProjectionStats
PASS 5ms★ Test\Fantasy\Feeds\Somber\DubStep::testGetNumGamesPlayed
PASS 12ms★ Test\Unicorn\Feeds\Somber\DubStep::testIsStatBonus
PASS 140ms Test\Fantasy\Feeds\Somber\DubStep::testIsPlayerUpdatedBaseConditions
PASS 7ms★ Test\Fantasy\Feeds\Somber\DubStep::testCalcNormalizedWeekProjection
COVERAGE REPORT
0% tests/feeds/lib/Feeds/Somber/Extension/usfoak-qub-te-hk3.json
0% tests/feeds/lib/Feeds/Somber/DubStep.php
93% feeds/lib/Feeds/Somber/PlayerProjectedStats.php
The coverage it runs a complete coverage report against the entire repository, and it doesn't cache the result. This means each file in each arc diff
has a coverage report run. In a small project that's not a big deal, but in a large project that makes a major difference. The best way to avoid this is use phpunit
coverage report directly and use --no-coverage
flag in all of your arc diff
s.