Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jasmine-diff-matchers

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jasmine-diff-matchers

Custom Jasmine matcher library to see a more useful diff view in the reporter output.

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by60%
Maintainers
1
Weekly downloads
 
Created
Source

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 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';

FAQs

Package last updated on 17 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc