Handle directories in tests folder. Fixes #138 #146
Watchers use digest to efficiently check if a file has changed.
In b1cb9e8 it was discovered that
The only known error at that time was if the file did not exist.
Rather than filtering for folders, I've expanded the known errors logic.
I also ran into problems with the tests in test-watcher. test-watcher
Watchers use digest to efficiently check if a file has changed. Digest does not handle missing files or directories well. So safe_digest was written to wrap digest and catch errors. In b1cb9e8 it was discovered that the error catching was too optimistic and was eating errors that should be reported to the user. To fix this, logic was added to catch the known errors from digest and re-raise all other errors. The only known error at that time was if the file did not exist. Unfortunately digest also throws an error if it is passed a directory. With the introduction of the new testthat tests folder structure, all tests folders also include a subfolder called testthat. When digest was passed the folder name it was failing. Rather than filtering for folder, I've expanded the known errors logic. The list of known errors is now encapsulated in a known_errors function. An error is checked against this list, and if it isn't found then the error is re-raised.