Commit Graph

220 Commits

Author SHA1 Message Date
Jhon Farias 0fe7c2440c fix(tia): fingerprint the bootstrap and include path the command line sets (#2068)
* fix(tia): fingerprint the bootstrap and include path the command line sets

* fix(tia): keep the bootstrap and include path in their own fingerprint fields

* fix(tia): keep a literal backslash in a Unix path in the fingerprint

* fix(tia): keep the include path entries apart in the fingerprint

* Refresh output snapshots for TIA configuration tests

---------

Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-24 00:48:55 +05:30
Jhon Farias 4c886b16d1 fix(tia): fingerprint the generated configuration like the restarter does (#2065)
* fix(tia): fingerprint the generated configuration like the restarter does

* test(tia): pass one configuration option per call

---------

Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-23 15:27:13 +05:30
Ben Dailey 8c87eefebf fix(tia): load rolldown from vite/rolldown under Vite+ (#2061)
* fix(tia): load rolldown from vite/rolldown under Vite+

* refactor(tia): call loadRolldown() with its default root

---------

Co-authored-by: Ben Dailey <ben@dev-deb12>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-22 22:09:09 +05:30
Ben Dailey 4cfeb458fe fix(tia): end the SFC script tag after quoted attributes that hold > (#2063)
Co-authored-by: Ben Dailey <ben@dev-deb12>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-22 21:32:28 +05:30
Jhon Farias a2d3e6badd fix(tia): support a Pest project nested in a git repository (#1914)
* fix(tia): support a Pest project nested in a git repository

Tia refused to run whenever the Pest project was not the git repository
root, because git prints and addresses paths relative to the repository
root while the dependency graph is keyed on project-relative paths.

Translate at every git boundary instead of guarding against the mismatch.
`Git::pathPrefix()` resolves the directory of the project inside the
repository, and `ChangedFiles` strips that prefix off the paths git prints,
drops the paths of sibling packages, and prepends it to `git show`. Both
diffs read `-z` records, because `core.quotePath` C-quotes a path outside
ASCII, and `--no-relative` holds the frame when a user sets `diff.relative`.

Three places read `<projectRoot>/.git` directly, which is absent in a
nested project and in a worktree, and now ask git: `BaseRemote`, `Storage`
and `Fingerprint::isTrackedByGit()`. `Storage` folds the prefix into the
state key so two projects in one repository do not share a graph, and the
fingerprint carries the prefix so a baseline published by a sibling project
is rejected. A project at the repository root keeps the key and the
fingerprint it had.

`git check-ignore` runs without `--no-index`, so a tracked file that an
ignore rule matches counts as part of the project on both sides of the
boundary.

Changes outside the project are dropped and reported by count in the run
summary, so a nested project does not look idle when the repository around
it moved.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(tia): keep whitespace at the edge of the paths git returns

* fix(tia): run the full suite when a PHP file outside a nested project changes

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-22 20:41:58 +05:30
Mohannad Elemary 66e585081a fix(tia): stop ReadCapture from keeping a wrapper per filesystem call (#2057)
* fix(tia): free the ReadCapture wrapper each time it steps aside

stream_wrapper_restore() takes a user wrapper out of the wrapper table
but does not free it, so every filesystem call made while a test records
kept one until the process ended. Unregistering it first frees it.

* fix(tia): skip the unregister when file:// is already gone

A test can unregister file:// itself. stream_wrapper_unregister() then
warns, where stream_wrapper_restore() alone did not, so check first.

Also run the per-test memory check over 5,000 tests and update the
snapshot and parallel totals for the new tests.

* Use fopen() in the memory regression test

---------

Co-authored-by: Mohannad Elemary <20709195+MohannadElemary@users.noreply.github.com>
2026-11-22 02:11:09 +05:30
Maks Oleksyuk 9a6ceb0699 feat: let a shard unit bundle several test classes (#1829)
* feat: let a shard unit bundle several test classes

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix: own unknown shard units in every shard and clean up worker timings

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix: drop removed test classes from shard units and consume coverage option values

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix: preserve empty shard units and consume more option values in discovery

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-21 01:03:33 +05:30
Jeremy Braband 996b5ee8f5 [5.x] TIA: stat once in ReadCapture::url_stat() (#2038)
* Stat once in ReadCapture url_stat

* Keep quiet url_stat probes away from error handlers

---------

Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-21 00:33:18 +05:30
Florian 776a44a391 Add an observer for the exit code after output plugins (#1905)
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-21 00:12:46 +05:30
Adam Goulding f5c3687a68 fix: beforeEach/afterEach leaking into sibling describe blocks with same nested name (#1850)
* fix: beforeEach/afterEach leaking into sibling describe blocks with same nested name

* fix: resolve afterEach test ordering issue

* chore: update snapshots and parallel memory limit after rebase onto upstream/5.x

* chore: update snapshots and parallel memory limit after rebase onto upstream/5.x

---------

Co-authored-by: Adam Goulding <adam.goulding@ethixbase360.com>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-20 19:14:17 +05:30
Syl 41af35a3f2 feat(tia): let a project leave paths out of read capture (#2030)
* feat(tia): let a project leave paths out of read capture

* Verify TIA watch fallbacks and refresh snapshots

---------

Co-authored-by: Sylvain Valienne <2300259+sylouuu@users.noreply.github.com>
Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
2026-11-20 18:41:03 +05:30
Ikki Nishihara f80b3a89a0 Reject the parallel short flag during retry (#2043)
Co-authored-by: haranishi <223786623+haranishi@users.noreply.github.com>
Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-20 15:12:02 +05:30
Ikki Nishihara bb91916d0d Run the generated Pest suite without a Tests autoload mapping (#2054)
Co-authored-by: haranishi <223786623+haranishi@users.noreply.github.com>
2026-11-20 01:13:13 +05:30
Lazizbek Ergashev b4fcb2091e fix(tia): apply the prefix and suffix of source exclude directories (#2032) 2026-11-18 20:59:39 +05:30
cyppe fbaa7fe8e9 fix(tia): fingerprint the configuration file the run uses (#1924)
* fix(tia): fingerprint the configuration file the run uses

* fix(tia): tell --no-configuration and identical copies of the configuration apart

* test(tia): cover the gitignore check with composer.lock, as the active configuration is fingerprinted tracked or not
2026-11-17 01:20:47 +05:30
atymic 433b9893d4 fix(tia): parse SFC entries when building the JS module graph (#1919)
* fix(tia): parse SFC entries when building the JS module graph

rolldown has no SFC handling, so every .vue/.svelte page failed to parse at the
first byte of <script> and the JS graph came back empty. Reduce the component to
its script blocks before rolldown sees it, which is enough for import specifiers.

Closes #1918

* fix(tia): keep template-only TS imports and stub CSS as JS

TypeScript elision dropped imports used only in a <template>, so lang="ts" pages lost those edges. Newer rolldown also rejects asset stubs without an explicit moduleType, failing the build on any CSS import.

* fix(tia): ignore comments when detecting default export

* Refresh SFC module graph regression snapshots

---------

Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
2026-11-16 23:05:31 +05:30
Jasper Tey 2d9dcd750a fix(tia): answer the stream_lock support probe (#2029)
* fix(tia): answer the stream_lock support probe

* Refresh stream lock regression snapshots

* Correct scoped callback typing and PHPStan compatibility

---------

Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
2026-11-16 19:27:18 +05:30
Daniel Polito 28c9dc277d feat(tia): make default watch fallbacks configurable (#1950)
* feat(tia): make default watch fallbacks configurable

* test(tia): cover driverless fallback and update suite snapshots

* fix: align help types and coverage guards with PHPStan

---------

Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-15 02:16:36 +05:30
cyppe 6f8b7998c2 fix(tia): re-run every test when a Laravel config or bootstrap file changes (#1926)
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-15 02:01:24 +05:30
Jeremy Braband 38c79452c1 fix(tia): link files a test reads as text, not only files it executes (#2006)
* fix(tia): link files a test reads as text, not only files it executes

* fix(tia): report dangling symlinks as links while reads are captured

`is_link()` stats with STREAM_URL_STAT_LINK | STREAM_URL_STAT_QUIET.
The `file_exists()` precheck in `ReadCapture::url_stat()` follows the
link, so a dangling symlink returned false before reaching `lstat()`,
and `is_link()` reported false while a test recorded.

Handle STREAM_URL_STAT_LINK first and always answer it through
`lstat()`. A quiet stat of a path that is neither a link nor a file
still returns false without a warning.

The regression test covers a link to an existing file and a dangling
link.

* test(tia): skip the read-capture feature tests without a coverage driver

The fixture runs record a graph from coverage, so with CI's
`coverage: none` all five cases failed. Skip them when
`Coverage::isAvailable()` is false, as CoveragePiggyback does.

* chore: style

* Refresh read capture test snapshots

---------

Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-15 00:54:24 +05:30
Jose Luis a483e38ddd fix(tia): memoize the merged baseline so replay stays linear (#1974)
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
2026-11-14 21:43:03 +05:30
Daniel Polito 89cdbd5bc9 Support --profile when running tests in parallel (#1795)
* feat: support profiling parallel tests

* test: preserve success snapshot totals

* test: preserve visual suite snapshot

* fix: stabilize checks on pull requests

* fix: align TIA fixture branch resolution

* chore: keep parallel profile changes scoped

* fix: align TIA fixture branch resolution

* Revert unrelated TIA branch fallback change

---------

Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
2026-11-14 21:33:34 +05:30
Tiago Santos a6b81dbd73 fix: check each target in negated toUse (#1933)
* fix: check each target in negated toUse

A skipped class in expect([...]) made the positive rule fail,
so the negation passed even when another class used the dependency.

Fixes #1751

* test: update snapshots for notToUse

Negated toUse coverage adds 6 tests and 24 assertions,
so the success snapshot and parallel totals were stale.

---------

Co-authored-by: Tiago Santos <tsantos@lynixt.pt>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-14 16:13:29 +05:30
Sonali dudhia 9aed110ba0 fix: run pest()->afterAll() hooks by flushing statics after tearDownAfterClass() (#1753)
* fix: run `pest()->afterAll()` hooks by flushing statics after `tearDownAfterClass()`

Fixes #1694

Testable::tearDown()'s finally block flushed the afterAll static after
every test via TestCaseMethodFactory::tearDown(), so by the time PHPUnit
called tearDownAfterClass() (which runs after the last test's tearDown())
the hook had already been nulled out. The per-test flush was redundant:
TestCaseMethodFactory::setUp() already flushes statics before re-applying
proxies for the next test. Move the flush into tearDownAfterClass()'s
finally block instead, so it happens after the hook actually runs.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* test: assert `afterAll` hooks run via isolated fixture suite

Runs a fixture suite in a subprocess and asserts both the
`pest()->afterAll()` and file-level `afterAll()` hooks ran once,
in order. Fails on unpatched 5.x (only `afterAll` is recorded).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* style: remove comment from afterAll hook test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Fix afterAll test style and refresh snapshots

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-14 15:13:25 +05:30
Ademola Emmanuel 65796f4939 Fix TIA fingerprinting inside linked git worktrees (#1813)
* fix(tia): fingerprint structural files inside linked git worktrees

* Update fingerprint regression snapshots

---------

Co-authored-by: Ademola Emmanuel <19527203+ademola-emmanuel@users.noreply.github.com>
Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-13 21:06:01 +05:30
Mikko 8e3f467d8a fix(sharding): strip --runner from the --list-tests sub-process (#2004)
* fix(sharding): strip `--runner` from the `--list-tests` sub-process

* fix(sharding): strip a space-separated `--runner` value too

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* test: count the two new shard tests in the visual suite totals

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Apa <mikko@apaiko.fi>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-13 19:36:20 +05:30
Thomas J. b9185c034c test: cover parallel group-filtered runs whose workers end on fully filtered files (#1985)
* test: cover parallel group-filtered runs whose workers end on fully filtered files

A worker's serialized TestResult only carries the `numberOfTests` of the
last file it executed. When that file has all of its tests excluded by
`--group`/`--exclude-group`, the merged result used to claim the suite was
empty and the run exited 1 despite a green summary (PHPUnit enables
`failOnEmptyTestSuite` implicitly for explicit test selections).

942d6aea fixed this in `WrapperRunner::numberOfTestsSeenByWorker()`; these
tests pin the behaviour:

- with `--processes=1` the single worker deterministically ends on
  ZTest.php, whose only test is outside the filtered group, so the run
  must exit 0 (fails when the fix is reverted)
- a selection that matches no tests at all must still exit non-zero

Refs #1483

* test: assert the empty-selection message and update the success snapshot

The empty-selection case now also expects `No tests found.` and exit code 1,
so it no longer passes when the run fails for an unrelated reason.

`tests/.snapshots/success.txt` gains the two new tests of
`tests/Visual/Parallel.php`.
2026-11-11 12:08:08 +05:30
Vincent Borgers e107ac707c Add default failure messages to the remaining string expectations (#1948)
* Add default failure messages to the remaining string expectations

* test: update parallel snapshot count for the new default-message cases

---------

Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-03 22:12:45 +05:30
Adil Khan b3baf7e210 fix: accept --no-results and the --do-not-* test run history options with --parallel (#1982)
* fix: accept `--no-results` and the `--do-not-*` test run history options with `--parallel`

* Update success snapshot count

---------

Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
2026-11-03 21:41:05 +05:30
ChrisAbner 9a77ff6b96 fix: let extensions register event subscribers in --parallel mode (#2002)
Co-authored-by: Aleksandr Štšepelin <as@jp.ee>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
2026-11-03 21:21:33 +05:30
Tiago Santos 960756e594 fix(tia): write the merged coverage report in chunks (#1997)
* fix(tia): write the merged coverage report in chunks

var_export() of the serialized coverage held a second escaped copy of the payload and exhausted memory after a large suite.

* test: count the chunked coverage report in visual snapshots

The two CoverageReport tests add two passes and four assertions to the suite totals.

* test: separate coverage report files in the success snapshot

Pest prints a blank line between files, so the snapshot was not a substring of the suite output.

---------

Co-authored-by: Tiago Santos <tsantos@lynixt.pt>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-03 20:09:40 +05:30
Tiago Santos 58570721c7 fix(tia): drop cached coverage of tests that no longer exist (#2000)
* fix(tia): drop cached coverage of tests that no longer exist

A deleted or renamed test never runs again, so its hits stayed in
coverage.bin.gz and --min passed on a real coverage drop.

Fixes #1957

* Update deleted coverage success snapshot

---------

Co-authored-by: Tiago Santos <tsantos@lynixt.pt>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-03 19:32:39 +05:30
Lazizbek Ergashev 0224b4238b fix(tia): drop the results of every branch on environment drift (#2011)
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-03 18:39:26 +05:30
Lazizbek Ergashev ceef9806c2 fix(tia): keep pcov.enabled when the pcov restarter re-runs pest (#2015)
* fix(tia): keep pcov.enabled when the pcov restarter re-runs pest

* test: cover pcov.enabled in the pcov restarter command

---------

Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-03 18:26:37 +05:30
Tiago Santos 8eb2892f69 fix(tia): skip locally() when the process is on CI (#1999)
* fix(tia): skip locally() when the process is on CI

locally() only looked at --ci, so a CI job that followed the docs and
ran plain pest replayed cached results.

Fixes #1970

* test(tia): clear CI variables so the local assertion passes on CI

* test: update snapshots for TIA CI detection

---------

Co-authored-by: Tiago Santos <tsantos@lynixt.pt>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-02 17:26:12 +05:30
Tiago Santos e7a1b483f0 fix(tia): drop coverage lines the current file no longer has (#2001)
* fix(tia): drop coverage lines the current file no longer has

An edited file left the previous line numbers in the cache as uncovered,
and a revert did not remove them.

Fixes #1954

* test: update snapshots for skipped stale coverage regression

---------

Co-authored-by: Tiago Santos <tsantos@lynixt.pt>
Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-11-01 01:07:56 +05:30
cyppe 415419a251 fix(tia): preserve numeric table dependencies across graph round trips (#1990)
Co-authored-by: nuno maduro <enunomaduro@gmail.com>
2026-10-27 10:39:18 +00:00
Tiago Santos 7abf68e706 fix: allow --init without a tests directory (#1939)
* fix: allow --init without a tests directory

Boot aborted before TIA state was registered, and shutdown then
tried to construct the plugin. That hid the real error behind
"State cannot be resolved" on a fresh install.

Closes #1934

* fix: detect --init anywhere in the arguments

Flags before --init were still treated as a normal run and failed when tests/ did not exist.

* fix: drop duplicate Kernel::$booted and share --init check

5.3.1 already gates plugin termination on boot, so the rebase must
not declare $booted again. --init and --init=value now share
HandleArguments::hasArgument, and the success snapshot includes
the new init tests.

* test: fix init suite expectations

Parallel total omitted the four --init tests, which
failed the success snapshot. Rector requires toBeFile().

---------

Co-authored-by: Tiago Santos <tsantos@lynixt.pt>
2026-10-26 16:21:56 +05:30
Paul Sochiera f730a186ce test(shard): cover module test classes outside the tests directory (#1689)
* test(shard): cover module test classes outside the tests directory

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

* chore: refresh the snapshot counts

---------

Co-authored-by: Paul Sochiera <paul.sochiera@gmail.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
2026-10-26 00:01:09 +05:30
Owen Voke d534cb2c40 fix: avoid passing an object when invoking static methods via reflection (#1988)
* fix: avoid passing an object when invoking static methods via reflection

PHP 8.6 deprecates passing an object to `ReflectionMethod::invoke()` for
static methods, which breaks higher-order assertions such as
`it('...')->assertTrue(true)` since `Assert::assertTrue()` is static.

* test: update visual snapshots for new reflection tests
2026-10-23 22:05:56 +05:30
Gustavo Meireles 1b3ca5ba41 feat: restore coversNothing() (#1981) 2026-10-18 21:53:51 +01:00
nuno maduro 3e5a2410b7 fix: phpunit classes not being inlcuded on sharding 2026-10-18 12:28:03 +01:00
Pushpak Chhajed e9fa0f50c5 perf: O(1) test method lookup 2026-10-16 22:20:38 +05:30
Punyapal Shah 5b98dc7df2 fix(sharding): prevent shard filters from matching classes outside their partition (#1884)
* fix(sharding): prevent shard filters from matching classes outside their partition

* lint

* test: update snapshots for the shard filter boundary cases
2026-10-12 00:09:04 +05:30
Lazizbek Ergashev 2440001cfc fix: datasets with a single named argument (#1894) 2026-09-08 21:12:15 +05:30
Lazizbek Ergashev 46df02dc28 fix: key Tia worker partials per process to survive batch recycling (#1782)
* fix: key Tia worker partials per process to survive batch recycling

* test(tia): refresh visual snapshots for the worker token test

---------

Co-authored-by: Punyapal Shah <53343069+MrPunyapal@users.noreply.github.com>
2026-08-26 14:06:49 +05:30
nuno maduro e763a87b42 chore: updates snapshots 2026-08-24 10:51:08 +01:00
nuno maduro b8c2265d66 fix: snapshot key on retry / repeat 2026-08-24 09:31:34 +01:00
Daniel Polito 39cbdcd52b Prevent memory exhaustion when generating TIA graphs with PCOV (#1875)
* fix(tia): preserve memory limit during pcov restart

* chore: update test expectations

* fix: stabilize tia replay test in ci
2026-08-24 08:41:59 +01:00
Andrew Matia cfe89d20ac Fix repeat with named dataset arguments (#1769) 2026-08-16 15:08:46 +01:00