simonzack
simonzack

Reputation: 20928

Unconditionally fail unit test

Is there a shorthand in jasmine equivalent to:

expect(true).toBe(false)

So the unit test can fail whenever it reaches this?

Upvotes: 1

Views: 105

Answers (1)

Ludwig Magnusson
Ludwig Magnusson

Reputation: 14389

I throw errors. I usually do this when I have created new test functions that are not implemented yet.

it('should test something when I have implemented it', function() {
    throw new Error('Not implemented yet');
});

This lets you use any explanation you want.

Upvotes: 3

Related Questions