-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RPP / Add 100% unit test coverage requirement for src #7510
Conversation
…outEncryptionService
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments for re-using current bash and workflow files (i.e. DRY principle), rather than introducing new files with very similar structures of existing files - which can be a burden for Harmony to update them in the future.
@htdat all good points. I've removed all nearly duplicate files, except for the XMLs. Could you please take another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@RadoslavGeorgiev - Looks excellent now.
I've removed all nearly duplicate files, except for the XMLs.
Agreed, we need to have a new XML config file to have a separate code coverage report for src
except that if there is a way that I don't know. However, even if there was a way, it seemed it's more complicated than just changing a few config lines.
My last comment is that we might also need to use the phpunit.xml.dist
config for only includes
, and leave src
for phpunit-src.xml.dist
.
This is my suggestion:
Index: phpunit.xml.dist
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
--- a/phpunit.xml.dist (revision e5dc5a913730827dfdf40671d0e2788cd528ba02)
+++ b/phpunit.xml.dist (date 1698307623999)
@@ -11,6 +11,7 @@
<testsuite name="WCPay">
<directory suffix=".php">./tests/unit</directory>
<exclude>./tests/unit/multi-currency</exclude>
+ <exclude>./tests/unit/src</exclude>
</testsuite>
<testsuite name="WCPayMultiCurrency">
<directory suffix=".php">./tests/unit/helpers</directory>
@@ -22,12 +23,6 @@
<filter>
<whitelist>
<directory suffix=".php">includes</directory>
- <directory suffix=".php">src</directory>
- <exclude>
- <!-- Service providers are simple, and ideally should not be used within tests. -->
- <directory suffix=".php">src/Internal/DependencyManagement/ServiceProvider</directory>
- </exclude>
</whitelist>
</filter>
-
</phpunit>
@htdat I'd prefer to intentionally keep
|
@RadoslavGeorgiev - that also makes sense. If so, at least, we would still get rid of directory |
@htdat done with 3 total files:
The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that makes sense now. Thanks for addressing my review.
Merging without Harmony's approval for now. If needed, we can change things. |
Changes proposed in this Pull Request
Allow the
src
directory's unit coverage to be checked separately fromincludes
.test:php-coverage-src
npm command, which only checkssrc
, and is significantly faster than the fullnpm run test:php-coverage
command.How this was achieved:
phpunit-src.xml.dist
to allow the selection of only thesrc
directory. Otherwise it is the same asphpunit.xml.dist
.bin/phpunit.sh
does not run by with-c phpunit.xml.dist
by default anymore, instead allowing other commands to define it.bin/check-src-test-coverage.sh
for the local command. Identical tobin/check-test-coverage.sh
, but with the new XML config.bin/run-ci-tests-check-src-coverage.bash
for the CI job, almost identical to the non-src
one as well..github/workflows/src-coverage.yml
is the definition of the GitHub workflow.Testing instructions
npm run test:php-coverage
andnpm run test:php-coverage-src
locally to make sure they work.npm run changelog
to add a changelog file, choosepatch
to leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.