organick
organick

Reputation: 1

Jasmine Matching Return Value

I got some typical jasmine code such as:

expect(actual).someMatcher(expected);

Is there a way to determine whether this matching succeed or failed (programmatically)? Depending on the result, I might want to do a certain operation afterwards. For example, if it fails, write the actual to disk.

Using the matcher's return value doesn't seem to work. It always returns undefined.

Upvotes: 0

Views: 136

Answers (1)

ggozad
ggozad

Reputation: 13105

The cleanest way would be to write your own reporter.

Alternatively, within a spec, this is the spec. this.results() would return the results, and you can get all you need by looking at the items_ property of the value of this.results().

Upvotes: 1

Related Questions