Skip to content

jest-resolve not honoring require cache #5120

Closed
@OzairP

Description

Do you want to request a feature or report a bug? Bug

What is the current behavior? jest-resolve or some other module does not honor require.cache

If the current behavior is a bug, please provide the steps to reproduce and
either a repl.it demo through https://repl.it/languages/jest or a minimal
repository on GitHub that we can yarn install and yarn test.

https://github.com/OzairP/jest-require-cache-no-honor

What is the expected behavior?
Tests should pass

Please provide your exact Jest configuration and mention your Jest, node,
yarn/npm version and operating system.

node: v8.6.0
npm: 5.3.0
yarn: 1.3.2
jest: 22.0.0

My current project hosts a tiny dependency injection container that is a singleton. When the app is setup it registers dependencies but in my tests I'm unable to mock my dependencies through my own container since the singleton is not shared between the test and the app.

Console screenshot: Note "index.js has someDep" line, this is from the setup
console

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions