You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My hunch is that the way $attributes just 'happen' in the view files is what trips up the code coverage.
Code coverage is basically walking through files and checking if the lines have been executed during the test run (a lot more complex than that but in essence 😅), and when it comes to the view files, and sees the $attributes variable out of nowhere it trips up and throws the undefined variable notice.
Still not sure where the CSS output comes out tbh.
in the phpunit.xml file. This will skip over those parts that are throwing these notices and preventing the code coverage to be executed properly.
The real fix is... Not simple.
I recon the fix could be to add a proper 'loader' for view files where the $attributes, $manifest etc. can be passed as arguments, and then the view PHP file could reference them using $this->arguments. Similar to this approach:
But this would require a careful rewrite of component and block loading in the eightshift-libs, plus all the blocks should be updated (to replace the 'magic' global variables appearing out of nowhere).
The positive could be that we might be able to cache some things (global manifest, etc.) and could have some performance gains.
Describe your bug
When using wp-pest to write integration tests, when checking the code coverage I get the following output:
And no coverage gets generated
Steps to Reproduce
XDEBUG_MODE=coverage ./vendor/bin/pest --group=integration --coverage
Expected behavior
I should get code coverage as in regular Pest tests.
Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in this repo.
Yes
Please confirm that you have searched in our documentation and couldn't find the answer.
Yes
Please confirm that your bug occurs with all plugins uninstalled and with the default WordPress theme active.
Yes
The text was updated successfully, but these errors were encountered: