SIGN IN SIGN UP

fix(core): scope Swift ignore patterns to test dirs, not file suffixes

The runtime matcher (`ignore` in ignore-filter.ts) runs with its default
`ignorecase: true`, so the previously proposed file-suffix globs were far
broader than they read:

  **/*Test.swift   -> Contest.swift, Latest.swift, Backtest.swift, Protest.swift
  **/*Tests.swift  -> Contests.swift
  **/*Spec.swift   -> Inspec.swift

This is not recoverable by writing the glob more carefully -- `ignore`
compiles patterns to a RegExp with the `i` flag, so a [Tt] character class
buys nothing. Since these starter lines exist to be uncommented wholesale,
silently dropping production source is the worst available failure mode.

Replaced with exact-name directory globs (**/Tests/**/*.swift,
**/Specs/**/*.swift) which carry no false-positive risk at all and, unlike
detectDirectories(), reach nested layouts such as Modules/Feature/Tests/.

Cross-language change, called out for review: SUFFIX_DIR_GLOBS is broadened
from [".tests", ".unittests", ".integrationtests"] to ["tests", "specs"].
The dotted C# forms all end in "tests", so three entries collapse to one
with no behaviour lost. This is what recovers Xcode's MyAppTests/ and
MyAppUITests/ targets. Suffix matching is safe *here* in a way the
equivalent file glob is not: it only ever runs against directories that
exist on disk, and emits them commented-out under their real name -- a repo
with a genuine Contests/ dir sees a literal `# Contests/` line it can
decline to uncomment. Note this now also applies outside Swift projects.

Accepted gap: nested Xcode-style dirs (Modules/Feature/FeatureTests/) are
reached by neither rule. Under-matching costs tokens; over-matching drops
source. Only one of those is a correctness bug.

Tests assert on real matcher behaviour rather than emitted text alone --
the gap that let the original patterns through review.

The earlier token-savings figures are removed rather than restated: they
were measured against the file-suffix shape and do not carry over. The
directory-scoped shape still needs re-measuring.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
T
thejesh23 committed
cb4dfeff735b4458b7aa101d9bd4b8aefbadbdd1
Parent: 3176a77