Custom Matchers make tests easier to read and produce relevant and useful messages when they fail.
By avoiding vague messages such as "expected false to be true" in favour of
useful cues such as "expected 3 to be even number" and avoiding implementation
noise such as
expect(cycleWheels % 2 === 0).toEqual(true) in favour of simply
stating that you
npm install jasmine-expect --save-dev
bower install jasmine-expect --save-dev
Downloads are available on the releases page.
and this default set of asymmetric matchers;
Jasmine-Matchers adds the following matchers;
Embed jasmine-matchers.js after Jasmine but before your tests.
Include the following in your
And the following at the top of your test suite;
Integration is easy with the karma-jasmine-matchers plugin.
Use the Jasmine CLI and include the path to where Jasmine Matchers is installed in the
helpers array of your
If you are using TypeScript, you might want to
npm install @types/jasmine-expect --save-dev in order to prevent your IDE from
complaining about the new Matchers.
Also, if you run into TypeScript compilation errors when running your tests,
"jasmine-expect" to the
"types" array in your tests'
As an example, for an Angular CLI based project, this would be your
|Android||4.0 - 5.1|
|Chrome||26 - 52|
|Firefox||4 - 48|
|Internet Explorer||9 - Edge|
|iOS||6.0 - 9.3*|
|Opera||11 - 12|
|Safari||6 - 9*|
* Safari 5.1 and iOS 5.1 are actually fully supported except for