Is there a way to add a Jasmine matcher to the whole environment

Sure, you just call beforeEach() without any spec scoping at all, and add matchers there. This would globally add a toBeOfType matcher. beforeEach(function() { var matchers = { toBeOfType: function(typeString) { return typeof this.actual == typeString; } }; this.addMatchers(matchers); }); describe(‘Thing’, function() { // matchers available here. }); I’ve made a file named spec_helper.js full … Read more

toBe(true) vs toBeTruthy() vs toBeTrue()

What I do when I wonder something like the question asked here is go to the source. toBe() expect().toBe() is defined as: function toBe() { return { compare: function(actual, expected) { return { pass: actual === expected }; } }; } It performs its test with === which means that when used as expect(foo).toBe(true), it … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)