Skip to content

fix(tia): exclude vendor from xdebug coverage while recording - #1867

Open
lazerg wants to merge 1 commit into
pestphp:5.xfrom
lazerg:fix/issue-1865-xdebug-coverage-filter
Open

fix(tia): exclude vendor from xdebug coverage while recording#1867
lazerg wants to merge 1 commit into
pestphp:5.xfrom
lazerg:fix/issue-1865-xdebug-coverage-filter

Conversation

@lazerg

@lazerg lazerg commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

What:

  • Bug Fix
  • New Feature

Description:

The recorder starts Xdebug coverage with no filter, so every executed line of vendor/ is traced and then dropped by the scope check in endTest(). The pcov path in the same class already narrows the file list before it collects anything.

Recorder::activate() now calls xdebug_set_filter() with the directories SourceScope treats as noise (vendor, node_modules, the cache directories, storage/framework), so Xdebug never instruments them. Xdebug only honours the filter for files compiled after it is set, which is why the call sits in activate() and not next to xdebug_start_code_coverage() in beginTest(). Every prefix ends with a separator, otherwise vendor would also match a sibling such as vendored.

The scope check after xdebug_get_code_coverage() stays, since the filter is a prefilter and not a replacement for it. The recorded graph is unchanged: tests/Features/Tia passes in full with Xdebug 3.5.3 in coverage mode.

I added a unit file for noisePaths() and bumped both suite tallies by hand, since composer update:snapshots would have baked in the Tests\Unit\Support\Backtrace failure I get on a clean 5.x here.

Related:

Fixes #1865

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TIA: the Xdebug recorder traces vendor/ and then discards it, where the pcov path restricts up front

1 participant