jest: [Bug]: v30 alpha: `testPathPatterns` that worked in the past not working any more.

Version

30.0.0-alpha.2

Steps to reproduce

yarn jest --config ./config/jest.config.js useLoadableQuery

Expected behavior

Jest finds the matching file src/react/hooks/__tests__/useLoadableQuery.test.tsx and executes it

Actual behavior

No tests found, exiting with code 1

Additional context

I understand that jest 30 had a change (in #12519) from a [TestPathPattern] option to [TestPathPatterns], but honestly, I’m failing to get anything to match this new option, even specifying the full path to the test doesn’t work.

From the issue, it seems like this doesn’t accept a RegEx anymore, but an array of patterns - but I’m not sure how to write those patterns. I’m getting errors like Invalid testPattern **/useLoadableQuery.* supplied. Running all tests instead..

This might be user error, but this change is very unexpected, and will probably seriously impact the workflows of most jest users and a ton of CI scripts, so I thought I’d open an issue to bring this to your attention.

Environment

System:
    OS: macOS 13.6
    CPU: (8) arm64 Apple M1 Pro
  Binaries:
    Node: 20.5.0 - ~/.nvm/versions/node/v20.5.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.8.0 - ~/.nvm/versions/node/v20.5.0/bin/npm
    pnpm: 8.7.6 - /opt/homebrew/bin/pnpm
  npmPackages:
    jest: 30.0.0-alpha.2 => 30.0.0-alpha.2

About this issue

  • Original URL
  • State: open
  • Created 7 months ago
  • Reactions: 1
  • Comments: 23 (21 by maintainers)

Commits related to this issue

Most upvoted comments

@SimenB PR submitted!

It does not happen in this very repo, at least 🙂

image