Repository navigation
Conversation
|
Heads up on an overlap, and two cases I hit while solving the same thing. #1915 also fingerprints the configuration file the run uses. There,
Two cases that mine covers and this PR does not:
Both PRs are open, so neither of us knows which one the maintainers take, or whether they want the configuration fingerprint in one place or the other. I am not rebasing either branch on the other. I am flagging the overlap so whoever merges the second one knows that |
|
Thanks, both cases were real. The fingerprint is now |
|
thank you! can you rebase this? |
e297d12 to
427749c
Compare
|
Rebased on 5.x, CI green locally. |
What:
Description:
The Tia fingerprint hashed
phpunit.xmlandphpunit.xml.distfrom the project root, and only when git tracks them. So:pest --tiais replayed bypest --tia -c phpunit.integration.xml, even though the two files can select different suites, groups, bootstrap and source.-cnever invalidates its graph.phpunit.xmlthat git ignores never invalidates the graph.phpunit.dist.xml, which PHPUnit also looks for, is not considered.This is a problem for projects that run several stages with their own configuration files and
pest()->tia()->directory()per stage. Today they need awatch()pattern per configuration file, and even that only re-runs tests, it does not invalidate the graph.This PR resolves the configuration file the run actually uses and fingerprints its content, tracked or not:
Tia\ConfigurationFile::fromArguments()passes only the configuration arguments (-c,--configuration,--configuration=,--no-configuration) to PHPUnit's ownCliArguments\BuilderandXmlConfigurationFileFinder. That gives the same lookup PHPUnit uses: a file, or a directory containingphpunit.xml,phpunit.dist.xmlorphpunit.xml.dist. TheConfigurationplugin runs before Tia, so the arguments always name the file in use, including the generated.pest.xml.Fingerprint::compute()accepts thatConfigurationFile. When none is given it uses the same default lookup in the project root. The twophpunit_xml*entries become onephpunit_configurationentry, andSCHEMA_VERSIONgoes to 19, so existing graphs rebuild once.<project-relative path>:<content hash>, so an identical copy of the configuration under another name or in another directory is a different configuration. Relative paths inside a configuration file resolve against its own directory. A run with--no-configurationstoresnone, so it can never share a fingerprint with a run that loads a file.XdebugRestarter::tiaWillReplay()resolves the file from the same arguments, so it compares like with like.Tests, in
tests/Features/Tia/ActiveConfiguration.php(sequential and parallel where it applies):-c phpunit.xml,-cshort form,--configuration=phpunit.xmland-c .still replay a graph recorded underphpunit.xml.phpunit.xmlthat git ignores stops the replay.tests/Unit/Plugins/Tia/ConfigurationFile.phpcovers the path-plus-hash value, a directory resolving like PHPUnit, and--no-configurationgivingnone.The last three fail on
5.x(all 6 tests replayed) and pass with this change. The tests assert what holds without a coverage driver, as on CI. With PCOV enabled I also checked that the edited run re-records under the new fingerprint and that the next run replays all 6 tests again.The existing replay-hooks test in
tests/Features/Tia.phpruns undertests/Fixtures/Suites/TiaReplayHooks.xml, so its seeded graph now fingerprints that file.composer test(lint, type check, type coverage, unit, parallel, integration) passes on PHP 8.4 and 8.5.Behaviour change to be aware of: projects that point two configuration files at one Tia directory used to share a graph silently, which is the replay this fixes. They now rebuild whenever they switch configuration.
pest()->tia()->directory()per configuration, the workaround in #1877, keeps one graph per configuration and replays in each.#1861 addressed the same issue by parsing
-cby hand; its author closed it for inactivity. This version defers to PHPUnit's resolver instead.Related:
Fixes #1858
🤖 Generated with Claude Code