Skip to content

[Bug]: Reporters are not loaded from global folders #15779

@c00ler

Description

@c00ler

Version

= v30.0.0-beta.6

Steps to reproduce

Hi!

We have a case where we need to place our custom jest reporter into one of Node.js global folders, i.e., ~/.node_libraries. Then our reporter is configured in the Jest config as @my-company/my-package/jest-reporter. This setup is working correctly with Jest versions up to 30.0.0-beta.5. After updating to 30.0.0-beta.6, the reporter can not be resolved anymore.

Looking at the changes between beta.5 and beta.6, most likely the behaviour changed after this PR #15619.

Expected behavior

Jest should be able to load reporters from Node.js global folders.

Actual behavior

Error: Could not resolve a module for a custom reporter. error is raised.

Additional context

Setting NODE_PATH=~/.node_libraries fixes the problem, but this approach defeats the purpose of having well-known folders.

Environment

System:
    OS: macOS 14.7.7
    CPU: (10) arm64 Apple M1 Max
  Binaries:
    Node: 22.17.0 - ~/.asdf/installs/nodejs/22.17.0/bin/node
    npm: 10.9.2 - ~/.asdf/plugins/nodejs/shims/npm
  npmPackages:
    jest: 30.0.5 => 30.0.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