Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lawrencec/cleanroom
Clears browser cookie and storage items to help with unit testing
https://github.com/lawrencec/cleanroom
Last synced: 20 days ago
JSON representation
Clears browser cookie and storage items to help with unit testing
- Host: GitHub
- URL: https://github.com/lawrencec/cleanroom
- Owner: lawrencec
- Created: 2016-11-12T10:51:46.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-05-23T12:12:28.000Z (over 4 years ago)
- Last Synced: 2024-11-02T07:33:33.791Z (2 months ago)
- Language: JavaScript
- Size: 101 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 19
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
# Clean Room [![Build Status](https://travis-ci.org/lawrencec/cleanRoom.svg?branch=master)](https://travis-ci.org/lawrencec/cleanRoom) [![Code Climate](https://img.shields.io/codeclimate/github/lawrencec/cleanRoom.svg)](https://codeclimate.com/github/lawrencec/cleanRoom) [![Test Coverage](https://img.shields.io/codeclimate/coverage/github/lawrencec/cleanRoom.svg)](https://codeclimate.com/github/lawrencec/cleanRoom/coverage) [![Latest Release](https://img.shields.io/github/release/lawrencec/cleanRoom.svg)](https://github.com/lawrencec/cleanRoom/releases)
Cleans up browser state:
- Cookies
- LocalStorage
- SessionStorage## Why?
To ensure that unit tests clean up after themselves. Includes a `snitch` method to determine when tests are not cleaning up correctly.
## Support
- Browser globals
- RequireJS## API
### cleanAll()
Removes all cookies, all LocalStorage and SessionStorage items
### cleanCookies()
Removes all cookies
### cleanLocalStorage()
Removes all LocalStorage items
### cleanSessionStorage()
Removes all SessionStorage items
### snitch()
Throws an error if there are any items left in cookies, LocalStorage or SessionStorage. Intended to be used in a unit test afterEach lifecycle method.
## Testing
Run `npm run test` to run tests using karma.
Run `npm run test:report` to open coverage report
Run `npm run lint` to run linting
Run `npm run` to view full list of available script tasks