Skip to content

Commit

Permalink
Only replace jimp module in webpack build
Browse files Browse the repository at this point in the history
  • Loading branch information
selaux committed Jul 30, 2018
1 parent 22dace1 commit 9b8c709
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
4 changes: 0 additions & 4 deletions karma.conf.js
Expand Up @@ -38,10 +38,6 @@ module.exports = function(config) {
},
resolve: {
alias: {
proxyquire: path.resolve(__dirname, './lib/browser/function.js'),
canvas: path.resolve(__dirname, './lib/browser/canvasFacade.js'),
mkdirp: path.resolve(__dirname, './lib/browser/function.js'),
gm: path.resolve(__dirname, './lib/browser/function.js'),
jimp: path.resolve(__dirname, './node_modules/jimp/browser/lib/jimp.js')
}
}
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -23,6 +23,7 @@
"eslint": "2.13.1",
"istanbul": "0.4.5",
"mocha": "3.2.0",
"resemblejs": "2.2.4",
"node-resemble-v2": "1.0.0",
"sinon": "2.1.0",
"sinon-chai": "2.9.0",
Expand Down
6 changes: 3 additions & 3 deletions test/functional/browser.js
Expand Up @@ -4,7 +4,7 @@ var Promise = require('bluebird'),
fs = require('fs'),
path = require('path'),
R = require('ramda'),
resemble = require('node-resemble-v2'),
resemble = require('resemblejs'),
chai = require('chai'),
expect = chai.expect,
base64 = require('base64-arraybuffer'),
Expand Down Expand Up @@ -45,7 +45,7 @@ describe('browser functional tests', function () {

expect(stylesheet).to.deep.equal(expectedStylesheet);
return Promise.fromCallback(function (callback) {
resemble(spritePngUrl).compareTo(expectedSpritePngUrl).ignoreColors().onComplete(function(result) {
resemble(spritePngUrl).compareTo(expectedSpritePngUrl).onComplete(function(result) {
expect(result).to.have.property('isSameDimensions', true);
expect(result).to.have.property('rawMisMatchPercentage').that.is.lessThan(0.5);
callback();
Expand All @@ -62,7 +62,7 @@ describe('browser functional tests', function () {

expect(stylesheet).to.deep.equal(expectedStylesheet);
return Promise.fromCallback(function (callback) {
resemble(spritePngUrl).compareTo(expectedSpritePngUrl).ignoreColors().onComplete(function(result) {
resemble(spritePngUrl).compareTo(expectedSpritePngUrl).onComplete(function(result) {
expect(result).to.have.property('isSameDimensions', true);
expect(result).to.have.property('rawMisMatchPercentage').that.is.lessThan(0.5);
callback();
Expand Down
2 changes: 1 addition & 1 deletion test/functional/node.js
Expand Up @@ -39,7 +39,7 @@ describe('node functional tests', function () {
expect(options).to.deep.equal(expectedOptions);

expect(fs.readFileSync(expectedStylesheetPath).toString()).to.equal(fs.readFileSync(stylesheetPath).toString());
resemble(expectedSpritePath).compareTo(spritePath).ignoreColors().onComplete(function(result) {
resemble(expectedSpritePath).compareTo(spritePath).onComplete(function(result) {
expect(result).to.have.property('isSameDimensions', true);
expect(result).to.have.property('rawMisMatchPercentage').that.is.lessThan(0.5);
done();
Expand Down
3 changes: 2 additions & 1 deletion test/unit/compositor/canvas.js
Expand Up @@ -5,6 +5,7 @@ var _ = require('underscore'),
chai = require('chai'),
expect = chai.expect,
inNode = require('../../utils/platform').inNode,
requireInNode = (m) => require(m),
createCanvasCompositor = require('../../../lib/compositor/canvas');

chai.use(require('chai-as-promised'));
Expand Down Expand Up @@ -122,7 +123,7 @@ describe('Compositor/canvas', function () {
});

inNode(describe, 'filterToParam', function () {
var Canvas = require('canvas'),
var Canvas = requireInNode('canvas'),
canvasCompositor = createCanvasCompositor(),
canvasInstance = new Canvas(0, 0);

Expand Down

0 comments on commit 9b8c709

Please sign in to comment.