FormidableLabs / FormidableLabs/jest-next-dynamic

Not compatible with Jest's resetMocks option

Open
#19 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
70
Forks
7
PR merge metrics
No merged PRs in 30d

Description

Hello,

First thank you for this great lib 😄

It seems that the way to use this library described in the documentation is not compatible with the `resetMocks` option of Jest.

Indeed, `next/dynamic` is only mocked for the first test and the real one is restored from the second test.

I don't know if it could be managed by the lib directly but it could be at least documented.

Regards,
Josselin BUILS

Contributor guide

Open the contributing guide

Research direction

Start with the documented usage and a test using Jest's resetMocks option; inspect how next/dynamic is mocked between tests. Reproduce that the mock is restored after the first test, then either make the library compatible or document the required setup and verify that subsequent tests retain the intended mock.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, next.js
Domain
testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.