xwp / wp-dev-lib

DEPRECATED. Common code used during development of WordPress plugins and themes
MIT License
279 stars 58 forks source link

phpunit runs twice in run_phpunit_local #158

Closed ocean90 closed 8 years ago

ocean90 commented 8 years ago

I set up my VVV install to support running unit tests from host.

But when the pre-commit now runs phpunit is called twice:

➜  glotpress git:(355-nonce-verification) ✗ .git/hooks/pre-commit
Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
Nothing to install or update
Generating autoload files
## Checking files, scope patches:
gp-includes/routes/glossary-entry.php:161-165
## PHP syntax check
No syntax errors detected in gp-includes/routes/glossary-entry.php
## PHP_CodeSniffer
## phpunit
Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Installing GlotPress...
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
PHPUnit 5.2.12 by Sebastian Bergmann and contributors.

Error:         No code coverage driver is available

...............................................................  63 / 251 ( 25%)
............................................................... 126 / 251 ( 50%)
............................................................... 189 / 251 ( 75%)
..............................................................  251 / 251 (100%)

Time: 6.99 seconds, Memory: 53.50Mb

OK (251 tests, 712 assertions)
Installing...
Running as single site... To run multisite, use -c tests/phpunit/multisite.xml
Installing GlotPress...
Not running ajax tests. To execute these, use --group ajax.
Not running ms-files tests. To execute these, use --group ms-files.
Not running external-http tests. To execute these, use --group external-http.
PHPUnit 5.2.12 by Sebastian Bergmann and contributors.

Error:         No code coverage driver is available

...............................................................  63 / 251 ( 25%)
............................................................... 126 / 251 ( 50%)
............................................................... 189 / 251 ( 75%)
..............................................................  251 / 251 (100%)

Time: 5.84 seconds, Memory: 52.00Mb

OK (251 tests, 712 assertions)
Skipping codeception since not configured

That seems to be caused by $PATH_INCLUDES which is ./ per default. find ./ ! -path . ! -path '*/dev-lib/*' -name 'phpunit.xml*' | sed 's:/[^/]*$::' (source) returns ./.

Should ! -path . be ! -path .* instead?

westonruter commented 8 years ago

I agree there is a problem here, but when I try ! -path .* I get an error:

find: ..: unknown primary or operator
westonruter commented 8 years ago

@ocean90 try #159.

ocean90 commented 8 years ago

@westonruter It needs to be in quotes:

find ./ ! -path '.*' ! -path '*/dev-lib/*' -name 'phpunit.xml*' | sed 's:/[^/]*$::'

westonruter commented 8 years ago

@ocean90 good point! :blush: I think #159 feels less hacky, so let's go with that until we “find” an alternative to -mindepth is needed.

ocean90 commented 8 years ago

@westonruter I agree.

btw: Found #144 which does the same, except for the dirname part.