Page MenuHomePhabricator

ArcanistLinterTestCase::executeTestsInDirectory() should fail when it finds 0 tests.
Closed, ResolvedPublic

Description

D7910 changed the behavior of these tests to only test files which end in .lint-test. Not being aware of this, after updating Arcanist all of our lint tests continued to pass however they were actually no longer testing anything. As future changes were made to linters, the tests started to rot.

Ideally, after pulling this update, this change should have been immediately apparent by having these tests fail with a clear error message like

No tests found in $dir with suffix .lint-test. Ensure $dir is not empty and test files end with .lint-test

Would allow the breakage to be quickly spotted and can follow through with renaming some files. This change will also ensure the test will not pass if the directory name is misspelled.

Event Timeline

leebyron assigned this task to epriestley.
leebyron raised the priority of this task from to Needs Triage.
leebyron updated the task description. (Show Details)
leebyron added a project: Arcanist.
leebyron added subscribers: leebyron, joshuaspence, beng.

Yeah, this is silly.

In the general case, we should probably fail tests which make no assertions (we likely have a few tests which pass by not throwing exceptions, but we could add trivial assertions in these cases).

epriestley triaged this task as Normal priority.Mar 7 2014, 3:17 PM
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.
epriestley edited this Maniphest Task.

This should be fixed in HEAD. Thanks for the report, and let us know if you run into anything else.

Thanks for the quick response @epriestley! I agree with you that the general case of failing a test when nothing was asserted is a good idea. I think it still may be a good idea for this particular case to have a clear error message, but at least now we're failing fast.