Try to fix node 10 unit test (#5235)

* fixed
* removed node 9
This commit is contained in:
Andrea Bogazzi 2018-09-16 22:51:51 +02:00 committed by GitHub
parent ffe01ab9f6
commit 5482ac350a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 26 deletions

View file

@ -64,10 +64,8 @@ jobs:
apt:
packages: # avoid installing packages
- stage: Unit Tests
env: LAUNCHER=Node CANFAIL=TRUE
env: LAUNCHER=Node
node_js: "10"
- stage: Unit Tests
node_js: "9"
- stage: Unit Tests
node_js: "8"
- stage: Unit Tests

View file

@ -26,25 +26,8 @@
var elImage = _createImageElement();
elImage.width = IMG_WIDTH;
elImage.height = IMG_HEIGHT;
setSrc(elImage, IMG_SRC, function() {
callback(elImage);
});
}
function setSrc(img, src, callback) {
if (fabric.isLikelyNode) {
require('fs').readFile(src, function(err, imgData) {
if (err) {
throw err;
};
img.src = imgData;
callback && callback();
});
}
else {
img.src = src;
callback && callback();
}
elImage.onload = callback;
elImage.src = IMG_SRC;
}
QUnit.module('fabric.Object', {

View file

@ -483,10 +483,13 @@
QUnit.test('fabric.util.loadImage with url for a non exsiting image', function(assert) {
var done = assert.async();
fabric.util.loadImage(IMG_URL_NON_EXISTING, function(img, error) {
assert.equal(error, true, 'callback should be invoked with error set to true');
done();
});
try {
fabric.util.loadImage(IMG_URL_NON_EXISTING, function(img, error) {
assert.equal(error, true, 'callback should be invoked with error set to true');
done();
}, this);
}
catch (e) { }
});
var SVG_WITH_1_ELEMENT = '<?xml version="1.0"?>\