Releases: searls/jasmine-given
v2.6.4
2.6.3
2.6.2
2.6.1
- Updates [email protected]
2.6.0
2.5.1
Improved Async Support
- jasmine-given's async support (for runners like karma and minijasminenode) has been improved to also allow done() calls for
When
,Invariant
, andAnd
statements. It accomplishes this by aggregating its own callbacks separately from whateverdone
callback is provided by the Jasmine runner that supports it. See 8ced259 for info.
Comparison Insights!
This release drastically improves output of tests that use comparators in Then
statements to determine if the test passes. Previously, the error message would simply say that the statement returned false, now it'll detect comparisons and evaluate both sides and print them out (so long as both sides are eval-able and don't result in ReferenceErrors).
Here's an example:
context "simple !== matcher", ->
Given -> @a = -> 1
Given -> @b = 3
Then -> @a() == @b
This will produce output like this:
Then clause `this.a() === this.b` failed by returning false
This comparison was detected:
this.a() === this.b
1 === 3
Similarly, if the two sides had deep-equalled each other, jasmine-given can now warn you that you should be using the toEqual matcher:
context "simple !== matcher", ->
Given -> @a = -> [1]
Given -> @b = [1]
Then -> @a() == @b
Which will advise:
Then clause `this.a() === this.b` failed by returning false
This comparison was detected:
this.a() === this.b
1 === 1
However, these items are deeply equal! Try an expectation like this instead:
expect(this.a()).toEqual(this.b)
Neat!
Keep in mind that this will result in a bunch of less-than-helpful ReferenceErrors if your Then
statements are comparing things that aren't reachable by this
or by global scopes. If both sides result in a reference error, jasmine-given will (╯°□°)╯︵ ┻━┻ and just continue doing what it always has.
2.3.0
2.2.0
Then.only
support for jasmine environments (like Karma, Protractor, and jasmine-only) which provide anit.only
mechanism for running only a single test. Ifit.only
isn't defined, the spec will explode ungracefully.- Fixes
Invariant
such that a false return value will fail a test