clean-room

2.0.0 • Public • Published

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

Package Sidebar

Install

npm i clean-room

Weekly Downloads

1

Version

2.0.0

License

ISC

Last publish

Collaborators

  • lawrencec