Package Exports
- jest-localstorage-mock
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jest-localstorage-mock) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Install
For yarn:
yarn add --dev jest-localstorage-mockFor npm:
npm i --save-dev jest-localstorage-mockSetup
Require module directly
In your package.json under the jest section add the setupFiles attribute with this module name.
"jest": {
"setupFiles": [
"jest-localstorage-mock"
]
}Use setup file
Alternatively you can create a new setup file and require this module.
__setups__/localstorage.js
global.chrome = require('jest-localstorage-mock');And add that file to your setupFiles:
"jest": {
"setupFiles": [
"./__setups__/localstorage.js"
]
}Usage
With this module setup in Jest you can run your web tests that rely on localstorage without fail.
Development
yarn install
yarn testPull Request
Before every PR run the following:
yarn run prettierPublish
When publishing a new build, run the following:
yarn run prettier
yarn run build
yarn publish