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

jasmine-matcher-errors

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jasmine-matcher-errors

Customize the error message reported by a custom jasmine matcher.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by400%
Maintainers
1
Weekly downloads
 
Created
Source

jasmine-matcher-errors

Customize the error message reported by a custom jasmine matcher.

Why?

The message returned by a custom jasmine matcher is duplicated into the error object created for the failed spec. This results in error messages always being output twice.

screenshot from 2016-06-01 09-04-53

Once you can customize the error message you could keep the message brief, and put more detailed information in the error message, or whatever makes sense for your custom matcher.

screenshot from 2016-06-01 09-05-56

Setup

jasmine-node

  1. Install from npm.
  • npm install --save-dev jasmine-matcher-errors
  1. Include in your custom matchers.
  • require('jasmine-matcher-errors')

jasmine

  1. Install from bower.
  • bower install --save-dev jasmine-matcher-errors
  1. Include before your custom matchers.
  • <script type="text/javascript" src="bower_components/jasmine-matcher-errors/src/index.js"></script>

Usage

Simply add an error object to the return object of your custom matcher.

jasmine.addMatchers({
  exampleMatcher: function() {
    return {
      compare: function(actual, expected) {
        ...
        return {
          pass: pass,
          message: message,
          error: new Error(message + '\n\n' + details)
        };
      }
    };
  }
});

Keywords

FAQs

Package last updated on 01 Jun 2016

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