{"id":3907,"date":"2012-03-07T09:19:50","date_gmt":"2012-03-07T14:19:50","guid":{"rendered":"http:\/\/www.ericfeminella.com\/blog\/?p=3907"},"modified":"2020-03-12T23:00:41","modified_gmt":"2020-03-13T03:00:41","slug":"jasmine-matchers-for-sinon-js","status":"publish","type":"post","link":"https:\/\/www.ericfeminella.com\/blog\/2012\/03\/07\/jasmine-matchers-for-sinon-js\/","title":{"rendered":"Jasmine matchers for Sinon.JS"},"content":{"rendered":"<p>Lately I have been finding myself writing custom <a href=\"http:\/\/jasmine.github.io\/\" target=\"_blank\" rel=\"noopener noreferrer\">Jasmine<\/a> matchers which wrap the <a href=\"http:\/\/sinonjs.org\/\" target=\"_blank\" rel=\"noopener noreferrer\">Sinon.JS<\/a> API as a convenience. After repeating this process quite a few times I took a step back to see if there was a similar solution already available. <\/p>\n<p>After a brief search, I quickly came across <a href=\"https:\/\/github.com\/froots\/jasmine-sinon\" target=\"_blank\" rel=\"noopener noreferrer\">jasmine-sinon<\/a> which, to my surprise, provides a very similar matcher API to that which I had began implementing. This library really is quite nice as it essentially provides matchers for all common Sinon.JS <a href=\"http:\/\/sinonjs.org\/docs\/#spies\" target=\"_blank\" rel=\"noopener noreferrer\">spies<\/a>, <a href=\"http:\/\/sinonjs.org\/docs\/#stubs\" target=\"_blank\" rel=\"noopener noreferrer\">stubs<\/a> and <a href=\"http:\/\/sinonjs.org\/docs\/#mocks\" target=\"_blank\" rel=\"noopener noreferrer\">mocking<\/a> use-cases. I am sure <em>jasmine-sinon<\/em> has saved many developers a lot of time by not having to write their own custom matchers as it has for me.<\/p>\n<p>And so, if you are using both Jasmine and Sinon.JS, and find yourself writing convenience matchers to simplify Sinon.JS integration, jasmine-sinon is an excellent addition which compliments both and is certainly worth considering.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lately I have been finding myself writing custom Jasmine matchers which wrap the Sinon.JS API as a convenience. After repeating this process quite a few times I took a step back to see if there was a similar solution already available. After a brief search, I quickly came across jasmine-sinon which, to my surprise, provides a very similar matcher API&#8230; <a class=\"read-more\" href=\"https:\/\/www.ericfeminella.com\/blog\/2012\/03\/07\/jasmine-matchers-for-sinon-js\/\">Continue Reading<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[42,78,31,35,40],"tags":[185,182,184,187,183,186,188,89,87],"class_list":["post-3907","post","type-post","status-publish","format-standard","hentry","category-apis","category-javascript-2","category-oop","category-software-engineering","category-test-driven-development","tag-bdd","tag-jasmine-2","tag-jasmine-sinon","tag-mocks","tag-sinon-js-2","tag-spies","tag-stubs","tag-test-driven-development-2","tag-unit-testing"],"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/posts\/3907","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/comments?post=3907"}],"version-history":[{"count":0,"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/posts\/3907\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/media?parent=3907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/categories?post=3907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ericfeminella.com\/blog\/wp-json\/wp\/v2\/tags?post=3907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}