How to mock localStorage in JavaScript unit tests?

This page summarizes the projects mentioned and recommended in the original post on reddit.com/r/codehunter

Our great sponsors
  • Appwrite - The Open Source Firebase alternative introduces iOS support
  • SonarLint - Deliver Cleaner and Safer Code - Right in Your IDE of Choice!
  • JetBrains - Developer Ecosystem Survey 2022
  • Scout APM - Less time debugging, more time building
  • Sinon.JS

    Test spies, stubs and mocks for JavaScript.

    I've been using Sinon.JS for most of my other javascript mocking and have found it is really great.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts