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

chai-mugshot

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai-mugshot - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

48

index.js

@@ -1,3 +0,1 @@

var Q = require('q');
/**

@@ -14,5 +12,10 @@ * Chai-Mugshot Plugin

function composeMessage(message) {
var standardMessage = 'expected baseline and screenshot of #{act}';
function composeMessage(item, message) {
var standardMessage = 'expected baseline and screenshot of \'' +
item.name + '\'';
if (item.selector) {
standardMessage = standardMessage + ' (' + item.selector + ')';
}
return {

@@ -25,27 +28,26 @@ affirmative: standardMessage + ' to ' + message,

function mugshotProperty(name, message) {
var msg = composeMessage(message);
Assertion.addProperty(name, function() {
var captureItem = this._obj;
var deferred = Q.defer();
var _this = this;
var _this = this,
captureItem = this._obj,
msg = composeMessage(captureItem, message);
mugshot.test(captureItem, function(error, result) {
if (error) {
deferred.reject(error);
} else {
if (testRunnerCtx !== undefined) {
testRunnerCtx.result = result;
}
return new Promise(function(resolve, reject) {
mugshot.test(captureItem, function(error, result) {
if (error) {
reject(error);
} else {
if (testRunnerCtx !== undefined) {
testRunnerCtx.result = result;
}
try {
_this.assert(result.isEqual, msg.affirmative, msg.negative);
deferred.resolve();
} catch (error) {
deferred.reject(error);
try {
_this.assert(result.isEqual, msg.affirmative, msg.negative);
resolve();
} catch (error) {
reject(error);
}
}
}
});
});
return deferred.promise;
});

@@ -52,0 +54,0 @@ }

{
"name": "chai-mugshot",
"version": "0.2.0",
"version": "0.3.0",
"description": "Chai plugin for Mugshot visual testing lib",

@@ -27,5 +27,2 @@ "main": "index.js",

},
"dependencies": {
"q": "^1.4.1"
},
"peerDependencies": {

@@ -32,0 +29,0 @@ "chai": "^3.2.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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