Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it supported to pass the second argument into the toBe matcher of Jasmine?

Tags:

jasmine

I found this code snippet from Angular's document, but cannot find this usage from Jasmine's docs. Is this really a supported feature? I just want to make sure that if I use this feature it will not break unexpectedly when upgrading to a newer minor/patch version.

expect(masterService.getValue())
.toBe(stubValue, 'service returned stub value');
like image 764
Jason Lee Avatar asked Dec 06 '25 05:12

Jason Lee


1 Answers

The supported method since 3.3 is withContext: https://jasmine.github.io/api/edge/matchers.html#withContext

expect(masterService.getValue()).withContext('service returned stub value')
.toBe(stubValue);
like image 95
waternova Avatar answered Dec 11 '25 12:12

waternova



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!