best place to run logic every test?

24 views
Skip to first unread message

Jesse

unread,
Apr 6, 2015, 11:58:30 PM4/6/15
to jasmi...@googlegroups.com
I have seen that one can put a beforeEach outside of describe blocks and then that logic will be executed before each one the specs ( regardless of file ).

ie. 
//jasmineSetup.js 
// logic executed three times
beforeEach(...)

// testSuiteA.js
describe(...one spec inside...)

// testSuiteB.js
describe(...two specs inside...)


Is there a better place to do it? I don't see anything in the jasmine docs on regarding this case.

Gregg Van Hove

unread,
Apr 8, 2015, 3:55:10 PM4/8/15
to jasmi...@googlegroups.com
A global `beforeEach` is the correct place to put any logic that should occur before every spec in your suite.

-Gregg

--
You received this message because you are subscribed to the Google Groups "Jasmine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jasmine-js+...@googlegroups.com.
To post to this group, send email to jasmi...@googlegroups.com.
Visit this group at http://groups.google.com/group/jasmine-js.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages