Jasmine describe override

Say you want to test your Angular application.

To do that you’ll be implementing Unit tests (with the Jasmine + Karma + PhantomJS stack) or E2E tests (with the Jasmine + Protractor stack).
You could choose any other stack using Cucumber, mocha, chai or any other testing framework – the principle of today’s topic remains the same.

The scenario is this:
There’s this piece of setup code that needs to be executed before each spec in every suite (performing login, for example).
I chose before each spec for the sake of the argument, but the same concept could be applied to before all specs in the suite and/or after each and after all specs in the suite.

for the sake of the post: describe = suite and it = spec.

Continue reading

Jasmine tests – setup describe

When I published the post about the Local Storage Cache Service, I also published the service code and test on GitHub.

This raised quite a few questions from readers in regards to the test. Specifically, why I implemented it with a main describe that contained an inner setup describe and an inner tests describe.

Continue reading