Sprockets-PHP
Sprockets-PHP copied to clipboard
Coveralls integration + Codeception
So i recently acquire some experience using coveralls.io.
I think we could improve the tests using Codeception and make a code-coverage report to Coveralls, so the users can explore all the acceptance and unit tests that we realize and see the latest code-coverage statistics for this project.
Do you like the idea? (if you like the idea i can start working on a pull-request)
https://coveralls.io/features
For sure. The tests are currently very ad-hoc, and their only "good" point is that "it's better than no tests at all"...
Excellent!!
I have this fork using Codeception
with the same tests you define and add some instructions to execute them in the README
file,
The current report summary:
- Classes: 28.00% (7/25)
- Methods: 38.20% (34/89)
- Lines: 50.70% (361/712) <-- coveralls use this porcentage
Now we need to improve this coverage report by adding more tests by each component.
I found some interesting points in Locator
class:
Methods | Tests |
---|---|
save | none |
skipFile | File::skipDirective() |
getPathsHash | none |
resolveFile | none |
hasDirectory | none |
getDirectoriesFor | Filter\Less |
This report concludes that 4 methods (save, getPathsHash, resolveFile and hasDirectory) are not used by any class and the 2 other methods need some tests using another classes.
The 4 methods mentioned doesn't have documentation, if we remove them we can improve the coveralls percentage by +2.53% (53.23%), do you think it's possible to delete these methods?
Mh, some of those are very useful at least. Need more tests.
I'm still unfamiliarzed with some aspects of this lib, i'll test all this methods.
-
save
: This method is very important to cache the location of files. This makes it so that*= require x
over and over won't need to look up where the file actually is all the time. -
skipFile
: Allows to exclude some files, so that they won't actually be required e.g. when requiring a whole directory. -
getPathsHash
: I don't remember, tbh. I think it's supposed to be used by getFileListName. -
resolveFile
: I don't remember what this was used for. -
getDirectoriesFor
: That's here to stay, but we should definitely add some tests that make use of it. i.e.import
from LESS, to prove that the import paths were used for.
I have managed to achieve 60.88% in coveralls implementing cache tests.
davidsosavaldes/Sprockets-PHP@052b180
Nice. The only thing I'm afraid is that including bootstrap in the tests will make finding the issue much harder, whenever something changes.
I was trying to use some filters but we can try something else, the bootstrap tests are deleted on commit: davidsosavaldes/Sprockets-PHP@b040cd5.