mardi 27 janvier 2015

When running jasmine tests, how can I know if I am in a describe block, beforeEach block or it block?

I need to throw an exception if a utility is used outside of an 'it' or 'beforeEach' block in my tests. Example -



describe('some test', function(){

useUtil(); // should throw exception

beforeEach(function(){
useUtil() // should work
})

it('should test something', function(){
useUtil() // should work
})
})


The util creates spies, and I want to make sure they are create in a way that allows Jasmine to clean them after every suite.


Aucun commentaire:

Enregistrer un commentaire