Skip to content

[Bug]: Something changed with version 29.4.3 where imports from jest setupFiles that are scoped to the imported file #5049

@leighsilversteincbc

Description

@leighsilversteincbc

Version

29.4.3

Steps to reproduce

Basically, if you follow the solution to getting @testing-library/jest-dom here:
https://dev.azure.com/rcmn/SSO/_git/B2CPageLayouts/pullrequest/98712

You'll see that the setupFile imports a library that extends the expect class to include more matchers. By doing this, you don't have to import the expect extenders in every file.

The previous version, 29.4.2, does not have this issue. Just 29.4.3 . We started seeing an issue with our builds this morning.

Expected behavior

When a jest expect matcher is imported in jest setup files, it no longer needs to be imported in individual test files

Actual behavior

The jest matcher imported in setup files is not carried over to individual files

Debug log

No log, sorry.

Additional context

So I'm not sure if this is an issue. I don't think there's any official way to piece all these libraries together, but I thought I would mention it, and see what you think the correct solution for this is.

Environment

System:
    OS: macOS 13.6.2
    CPU: (10) arm64 Apple M1 Pro
  Binaries:
    Node: 22.15.0 - /usr/local/bin/node
    npm: 10.9.2 - /usr/local/bin/npm
    pnpm: 9.6.0 - ~/Library/pnpm/pnpm
  npmPackages:
    jest: ^29.7.0 => 29.7.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions