clarkbw / jest-localstorage-mock

A module to mock window.localStorage and window.sessionStorage in Jest

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docs: usage with create-react-app now requires explicitly setting resetMocks: false

mfogel opened this issue · comments

Hi, thanks for this package, appreciate you sharing your work.

Since create react app 4.0, the default jest config has resetMocks: true set.

This is a bit controversial because it breaks stuff (including this packge).... see facebook/create-react-app#9935 Personally I think they would have been better off to stay conservative and just set clearMocks: true.

In any case, it might be worth mentioning in the README for this package that:

  • setting resetMocks: true will break this package
  • when using create react app, you need to explicitly set resetMocks: false

Thanks for the heads up in filing this issue!

If you wouldn't mind updating the README I think the two places that need mention are:

Thanks!