New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

chai-resemble

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai-resemble - npm Package Compare versions

Comparing version 0.0.3 to 0.2.0

lib/resemble.js

35

chai-resemble.js

@@ -1,12 +0,16 @@

var fs = require('fs'),
gm = require('gm'),
path = require('path'),
phantom = require('phantomjs'),
/**/
info_msg = '\n The screenshots can be located at ' +
path.join(__dirname, 'screenshots');
'use strict';
module.exports = function (chai, utils) {
'use strict';
var fs = require('fs'),
path = require('path'),
phantom = require('phantomjs'),
resemble = require('./lib/resemble.js');
function info_msg(percentage) {
return '\n misMatchPercentage: ' + percentage +
'\n The screenshots can be located at ' +
path.join(__dirname, 'screenshots');
}
module.exports = function (chai) {
chai.Assertion.addMethod('resemble', function (other, tolerance, callback) {

@@ -36,11 +40,10 @@ if (typeof tolerance === 'function') {

}
gm.compare(child_args[3], child_args[4], tolerance, function (err, isEqual) {
if (err) {
return callback(err);
}
resemble(child_args[3], child_args[4], function (data) {
assertion.assert(
isEqual === true,
'expected ' + assertion._obj + ' to resemble ' + other + info_msg,
'expected ' + assertion._obj + ' to not resemble ' + other + info_msg
data.misMatchPercentage <= tolerance,
'expected ' + assertion._obj + ' to resemble ' + other +
info_msg(data.misMatchPercentage),
'expected ' + assertion._obj + ' to not resemble ' + other +
info_msg(data.misMatchPercentage)
);

@@ -47,0 +50,0 @@

{
"name": "chai-resemble",
"version": "0.0.3",
"version": "0.2.0",
"description": "Chai helper for visually comparing HTML pages",

@@ -28,3 +28,2 @@ "main": "chai-resemble.js",

"devDependencies": {
"phantomjs": "~1.9.2-6",
"chai": "~1.8.1",

@@ -34,4 +33,7 @@ "mocha": "~1.17.1"

"dependencies": {
"gm": "~1.14.2"
"pngparse": "~2.0.1"
},
"peerDependencies": {
"phantomjs": "~1.9.7-1"
}
}
chai-resemble
=============
Chai helper for visually comparing HTML pages
Chai helper for visually comparing HTML pages.
Inspired by [Resemble.js](https://github.com/Huddle/Resemble.js)

@@ -9,3 +10,3 @@ #Installation#

Note: it requires you to have PhantomJS installed as well.
Note: to use this helper, you should also have [PhantomJS](https://github.com/Obvious/phantomjs) installed.

@@ -26,1 +27,5 @@ #Usage#

});
## License
Copyright (c) 2013 Giacomo Martino. See the [LICENSE](/LICENSE.md) file for license rights and limitations (MIT).
This module includes code from [Resemble.js](https://github.com/Huddle/Resemble.js), released under the MIT license.
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