Skip to content

[Bug]: Jest 30 testPathPatterns not working in Jest config file #15645

@lencioni

Description

@lencioni

Version

30.0.0-beta.5

Steps to reproduce

  1. clone https://github.com/lencioni/jest-test-path-patterns.git
  2. yarn install
  3. yarn jest --config singular.config.js
  4. yarn jest --config plural.config.js

Expected behavior

I expect to see no configuration validation warnings for the plural config, and I expect the plural config to not try to run the helper file as a test.

Actual behavior

The singular config with testPathPattern logs this warning:

● Deprecation Warning:

  Option "testPathPattern" was replaced by "testPathPatterns".

  Please update your configuration.

  Configuration Documentation:
  https://jestjs.io/docs/configuration

● Deprecation Warning:

  Option "testPathPattern" was replaced by "testPathPatterns".

  Please update your configuration.

  Configuration Documentation:
  https://jestjs.io/docs/configuration

The plural config with testPathPatterns logs this warning:

● Validation Warning:

  Unknown option "testPathPatterns" with value [/\.test\.js$/] was found.
  This is probably a typing mistake. Fixing it will remove this message.

  Configuration Documentation:
  https://jestjs.io/docs/configuration

● Validation Warning:

  Unknown option "testPathPatterns" with value [/\.test\.js$/] was found.
  This is probably a typing mistake. Fixing it will remove this message.

  Configuration Documentation:
  https://jestjs.io/docs/configuration

Both the plural and the singular configs run the helper file.

The --testPathPatterns CLI flag works without any validation warnings and it does not run the helper file:

yarn jest --testPathPatterns=".*\.test\.js$"

Additional context

Possibly related:

Environment

System:
    OS: macOS 15.4.1
    CPU: (8) arm64 Apple M3
  Binaries:
    Node: 22.16.0 - ~/.local/share/mise/installs/node/22.16.0/bin/node
    Yarn: 1.22.22 - ~/.local/share/mise/installs/yarn/1.22.22/bin/yarn
    npm: 10.9.2 - ~/.local/share/mise/installs/node/22.16.0/bin/npm
  npmPackages:
    jest: ^30.0.0-beta.5 => 30.0.0-beta.5

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions