Skip to content

Test discovery: +, $ and ^ in a glob are read as regex operators #247

Closed

Description

@FredApps

globToRegex in src/repo/test-discovery.ts escapes only \ and ., so +, $ and ^ reach RegExp as operators. These globs come from declared inputs and runner configs.

Repro:

  • A declared input { "paths": ["app/routes/users.$id.tsx"], "tests": [...] }: changing app/routes/users.$id.tsx does not select the declared tests.
  • app/routes/_auth+/** (remix-flat-routes folders) does not match app/routes/_auth+/login.tsx.
  • c++/** throws Invalid regular expression: Nothing to repeat.
  • A bare ** matches only top-level paths.

Expected: these characters match themselves and ** matches every path, as in picomatch. Classes such as [^b], groups and extglobs keep working.

Actual: as above.

The same class of bug in other copies of the converter: #173 (planner, PR #174) and #178 (research matcher, PR #179). This issue is the test-discovery.ts copy, which neither PR changes.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions