lawrencec / cleanRoom

Clears browser cookie and storage items to help with unit testing
1 stars 0 forks source link

Clean Room Build Status Code Climate Test Coverage Latest Release

Cleans up browser state:

Why?

To ensure that unit tests clean up after themselves. Includes a snitch method to determine when tests are not cleaning up correctly.

Support

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