beforeEach

23 views
Skip to first unread message

Avi Li

unread,
Jan 31, 2015, 7:54:20 AM1/31/15
to jasmi...@googlegroups.com
Hi,
I have an async beforeEach in my sepc.
It's being called for EVERY test (every "it") instead of once.
What ma I doing wrong?

Greg Cobb

unread,
Jan 31, 2015, 4:39:59 PM1/31/15
to jasmi...@googlegroups.com
'beforeEach' runs before every spec. If you want your setup code to only run once, use 'beforeAll' (introduced in Jasmine 2.1). 

As a side note, I recommend against using 'beforeAll' unless you absolutely need to. Having shared setup between tests can result in test pollution if you aren't careful. 

--
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