Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/impaler/jasmine-diff-matchers
Jasmine matchers that output a colorized diff view.
https://github.com/impaler/jasmine-diff-matchers
Last synced: about 2 months ago
JSON representation
Jasmine matchers that output a colorized diff view.
- Host: GitHub
- URL: https://github.com/impaler/jasmine-diff-matchers
- Owner: impaler
- License: mit
- Created: 2015-02-08T22:05:38.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-17T23:02:39.000Z (almost 10 years ago)
- Last Synced: 2024-11-16T06:15:30.832Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 188 KB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
Custom Jasmine 2.x matchers for seeing a more useful output when comparing Strings.
For example you may want to compare files, seeing the output from `expect(expected).toBe(result)`
only outputs the entire comparison with no hint to any deletions, additions and what is the same.Using the [diff](https://www.npmjs.com/package/diff) the result of the diff matchers will be colored like
your regular vcs tooling.### Examples
See the examples in the `./example/*` folder. Using the matchers requires you to add them using
the Jasmine `addMatchers()` api in a `beforeEach` block, Example.```
beforeEach(function () {
jasmine.addMatchers(require('jasmine-diff-matchers').diffChars);
});
```Now the custom matchers are added to the Jasmine api just like any other core matcher:
```
it('should display the same quote from Carl Sagan.', function () {
expect('pale blue dot').diffChars('pale yellow dot');
});
```You can change the default deletionsColor, addedColor and sameColor with the config:
```
require('../config').addedColor = 'blue';
```