* 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>
* 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
paratest 7.26.1 added a required $tmpDir argument to WrapperWorker and
keeps worker files in a private per-run directory. Create that 0700
directory per run, pass it to each worker and remove it on completion.
Require paratest ^7.26.1.
* refactor: extract shared CI detection utility
Consolidate duplicated CI environment detection logic from
Snapshot and BaselineSync into a shared Pest\Support\Ci class.
This reduces duplication and provides a single source of truth
for CI detection, including comprehensive environment variable
checks for all major CI providers.
* fix(tia): persist state on detached HEAD
Allow detached checkouts to write, delete, and rebuild TIA state so
baseline publishers and local detached workflows produce a usable graph.
Resolve the writable baseline from the Git branch, CI branch metadata, or
a stable workspace key. Keep the default branch as the read fallback so
local workspaces can use a published baseline without changing it.
Extract BaselineSync into a provider architecture with an abstract
BaseRemote class and concrete GitHubRemote/GitLabRemote implementations.
GitLab support uses the glab CLI to fetch TIA baselines from CI
pipelines. The GitLabRemote queries the GitLab API for the latest
successful job matching the configured name on the default branch,
then downloads artifacts via `glab job artifact`.
Self-hosted GitLab instances are supported automatically: any
non-GitHub remote is detected as GitLab when the glab CLI is
installed, with authentication validated at fetch time.
Key changes:
- BaseRemote abstract class holds shared logic: CLI existence/auth
checks, error classification, git remote URL parsing, and default
branch resolution
- GitHubRemote extracts existing gh CLI logic unchanged
- GitLabRemote adds glab CLI support with default job name
`tia-baseline`, configurable via `->baselined(job: "name")`
- BaselineSync becomes a provider-agnostic orchestrator that iterates
registered remotes to detect the matching CI provider
- Configuration::baselined() accepts optional `job` parameter for
GitLab job name customization
- GitLab job query filters by both job name and default branch ref
to ensure cache key matches downloaded artifact
* 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>
When phpunit.xml has <coverage> and <source> sections, PHPUnit
auto-initializes its code coverage driver which takes over
xdebug's coverage APIs. TIA's recorder then gets empty data
from xdebug_get_code_coverage(), resulting in zero recorded
edges and no graph being saved.
Inject --no-coverage into the arguments when TIA enters its
own recording mode (not piggybacking on an explicit coverage
report). This tells PHPUnit to ignore XML-configured coverage
reports, leaving xdebug free for TIA's per-test recording.
Having <coverage> and <source> in phpunit.xml is standard for
any project that generates coverage reports. Without this fix,
users must manually pass --no-coverage alongside --tia, which
is an unnecessary footgun.
* feat: allow configuring the TIA directory
* refactor: simplify TIA directory resolution
* fix: bootstrap TIA state after configuration
* chore: apply Rector to TIA storage test
* fix: stabilize checks on pull requests
* fix: align TIA fixture branch resolution
* fix: preserve success snapshot formatting
* fix: order TIA storage snapshot
* chore: keep TIA directory changes scoped