Skip to content

Clears browser cookie and storage items to help with unit testing

Notifications You must be signed in to change notification settings

lawrencec/cleanRoom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clean Room Build Status Code Climate Test Coverage Latest Release

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

About

Clears browser cookie and storage items to help with unit testing

Resources

Stars

Watchers

Forks

Packages

No packages published