Skip to content

[Bug]: Cannot find module in jest v28 #12372

@BlackGlory

Description

@BlackGlory

Version

28.0.0-alpha.0

Steps to reproduce

git clone https://github.com/BlackGlory/jest-v28-issue-reproduction.git
cd jest-v28-issue-reproduction
yarn install
yarn jest

Expected behavior

It should import the module like Node.js:

node __tests__/index.js

Actual behavior

 FAIL  __tests__/index.js
  ● Test suite failed to run

    Cannot find module 'extra-request/transformers/index.js' from '__tests__/index.js'

    > 1 | require('extra-request/transformers/index.js')
        | ^
      2 |

      at Resolver.resolveModule (node_modules/jest-resolve/build/resolver.js:317:11)
      at Object.<anonymous> (__tests__/index.js:1:1)

Additional context

The related comment: #9771 (comment)

Environment

Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
Yarn: 1.22.17 - ~/.nvm/versions/node/v16.13.1/bin/yarn
npm: 8.1.2 - ~/.nvm/versions/node/v16.13.1/bin/npm
npmPackages:
  jest: ^28.0.0-alpha.0 => 28.0.0-alpha.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions