jest-localstorage-mock

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

BSD-3-CLAUSE License

Downloads
1.4M
Stars
320
Committers
13

Bot releases are hidden (Show)

jest-localstorage-mock - jsdom localStorage and sessionStorage support Latest Release

Published by clarkbw almost 6 years ago

Thanks to @geoffdutton in https://github.com/clarkbw/jest-localstorage-mock/pull/80 we have support for the latest version of jest which pulls in an updated jsdom.

jest-localstorage-mock - Enumerable properties

Published by clarkbw almost 7 years ago

Thanks to the work by @mcshiz in PR #60 🎉 the localStorage and sessionStorage objects are now enumerable. This means if your code includes functions like Object.keys(localStorage) you'll now retrieve the expected storage items instead of the private mocked functions.

jest-localstorage-mock - Node LTS support

Published by clarkbw almost 7 years ago

This release updates the build to target the current active Node LTS release.

If you need to support older node releases like 4.x and are using babel use the import syntax which should pull in the module source code instead of the built code and can compile as needed.

jest-localstorage-mock -

Published by clarkbw about 7 years ago

This release fixes the issue https://github.com/clarkbw/jest-localstorage-mock/issues/35 where values were not being coerced into strings before storage.

jest-localstorage-mock - SessionStorage

Published by clarkbw about 7 years ago

This new release includes support for a sessionStorage global which is a duplicate of all the existing localStorage methods.

While this isn't a breaking change, it is a large change to the library so I wanted a bump from the original version to notify consumers. Please file an issue if you do see a change that isn't backwards compatible with the previous 1.x release.