digitalpulp / pre-commit-php

Pre-commit scripts appropiate for *any* PHP project. These hooks are made as custom plugins under the [pre-commit](http://pre-commit.com/#new-hooks) git hook framework.
https://www.digitalpulp.com
Apache License 2.0
54 stars 36 forks source link

pre-commit run --verbose --all-files results in multiple, redundant runs of `php-unit`, `php-cs`, etc. #21

Open posita opened 3 years ago

posita commented 3 years ago
% git status
On branch [branch]
Your branch is up to date with '[branch]'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
  [4 changed files]

% pre-commit run --verbose --all-files
…
PHP Unit.................................................................Failed
- hook id: php-unit
- duration: 0.81s
- exit code: 1

Begin PHP Unit Task Runner
Running command  vendor/bin/phpunit
────────────────────────────────────────────────────────────────────────────────
Failures detected in unit tests...
────────────────────────────────────────────────────────────────────────────────
PHPUnit 9.5.10 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.3.11
Configuration: /…/phpunit.xml
Warning:       No code coverage driver available

F                                                                   1 / 1 (100%)

Time: 00:00.515, Memory: 6.00 MB

There was 1 failure:

1) dummyTest::test_Dummy
Failed asserting that 1 matches expected 0.

/…/tests/dummyTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
Begin PHP Unit Task Runner
Running command  vendor/bin/phpunit
────────────────────────────────────────────────────────────────────────────────
Failures detected in unit tests...
────────────────────────────────────────────────────────────────────────────────
PHPUnit 9.5.10 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.3.11
Configuration: /…/phpunit.xml
Warning:       No code coverage driver available

F                                                                   1 / 1 (100%)

Time: 00:00.516, Memory: 6.00 MB

There was 1 failure:

1) dummyTest::test_Dummy
Failed asserting that 1 matches expected 0.

/…/tests/dummyTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
Begin PHP Unit Task Runner
Running command  vendor/bin/phpunit
────────────────────────────────────────────────────────────────────────────────
Failures detected in unit tests...
────────────────────────────────────────────────────────────────────────────────
PHPUnit 9.5.10 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.3.11
Configuration: /…/phpunit.xml
Warning:       No code coverage driver available

F                                                                   1 / 1 (100%)

Time: 00:00.514, Memory: 6.00 MB

There was 1 failure:

1) dummyTest::test_Dummy
Failed asserting that 1 matches expected 0.

/…/tests/dummyTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
Begin PHP Unit Task Runner
Running command  vendor/bin/phpunit
────────────────────────────────────────────────────────────────────────────────
Failures detected in unit tests...
────────────────────────────────────────────────────────────────────────────────
PHPUnit 9.5.10 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.3.11
Configuration: /…/phpunit.xml
Warning:       No code coverage driver available

F                                                                   1 / 1 (100%)

Time: 00:00.516, Memory: 6.00 MB

There was 1 failure:

1) dummyTest::test_Dummy
Failed asserting that 1 matches expected 0.

/…/tests/dummyTest.php:6

FAILURES!
Tests: 1, Assertions: 1, Failures: 1.
posita commented 3 years ago

This is also the case with php-cs.