Mock localStorage in Jasmine 2.x tests. Version 1.1.2 is the latest stable, compatible with Jasmine >=2 and <5. It provides simple `mockLocalStorage()` and `unmockLocalStorage()` functions that replace the global localStorage with a spy-based mock, allowing assertions on calls like `setItem`, `getItem`, etc. Unlike full localStorage polyfills, this package integrates directly with Jasmine's spy framework, enabling call-count checks and clean state between tests. Low maintenance; last release 2021.
npm install jasmine-local-storageNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows setup and basic usage: mock localStorage in beforeEach, unmock in afterEach, and verify spy calls.
Upgrade jasmine-local-storage if possible, or pin Jasmine version to 4.x.
Consider alternatives like jest-localstorage-mock or manual spies.
Ensure jasmine is installed as devDependency; use 'require' in helper before specs run.
Always pair mockLocalStorage with unmockLocalStorage, e.g., in afterEach or afterAll.
Add 'require("jasmine-local-storage")' in jasmine helper or spec top-level.Downgrade Jasmine to 4.x or switch to a different mock library.
Run 'npm install --save-dev jasmine-local-storage' and ensure it's listed in devDependencies.