Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.
This repository was archived by the owner on May 1, 2020. It is now read-only.

TypeError: this._loadImage is not a function #56

@ybouhjira

Description

@ybouhjira

I get this error when trying to use the library, here is the code I run:

const BlinkDiff = require('blink-diff');
const path = require('path');
const {promisify} = require('util');
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');

chai.should();
chai.use(chaiAsPromised);

const config = require('../../src/config');

function comparer(refImage, testImage, diffPath) {
    const diff = new BlinkDiff({
        imageAPath: refImage, // Use file-path
        imageBPath: testImage,

        thresholdType: BlinkDiff.THRESHOLD_PERCENT,
        threshold: config.tolerance,

        imageOutputPath: diffPath
    });

    return promisify(diff.run)();
}

describe('BlinkDiff comparing module', () => {
    it('should detect visual difference', () => {
        const result = comparer(
            path.join(__dirname, '../image/ref.png'),
            path.join(__dirname, '../image/test.png'),
            path.join(__dirname, '../image/diff.png'),
        );
        result.should.eventually.have.property('mismatchPercentage');
        result.should.eventually.deep.equal({misMatchPercentage: 1});
        result.then(({mismatchPercentage}) => {
            mismatchPercentage.should.be.lessThan(config.tolerance);
        })
    });
});

The error output

"C:\Program Files\nodejs\node.exe" D:\code\new-test\node_modules\mocha\bin\_mocha --ui bdd --reporter "C:\Program Files\JetBrains\WebStorm 2017.2.4\plugins\NodeJS\js\mocha-intellij\lib\mochaIntellijReporter.js" D:\code\new-test\test\lib\blinkdiff-comparer.test.js --grep "BlinkDiff comparing module "
TypeError: this._loadImage is not a function
    at D:\code\new-test\node_modules\blink-diff\index.js:359:16
    at D:\code\new-test\node_modules\promise\lib\es6-extensions.js:18:19
    at flush (D:\code\new-test\node_modules\asap\asap.js:27:13)
    at _combinedTickCallback (internal/process/next_tick.js:132:7)
    at process._tickCallback (internal/process/next_tick.js:181:9)
(node:8644) UnhandledPromiseRejectionWarning: TypeError: this._loadImage is not a function
    at D:\code\new-test\node_modules\blink-diff\index.js:359:16
    at D:\code\new-test\node_modules\promise\lib\es6-extensions.js:18:19
    at flush (D:\code\new-test\node_modules\asap\asap.js:27:13)
    at _combinedTickCallback (internal/process/next_tick.js:132:7)
    at process._tickCallback (internal/process/next_tick.js:181:9)
(node:8644) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:8644) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:8644) UnhandledPromiseRejectionWarning: TypeError: this._loadImage is not a function
    at D:\code\new-test\node_modules\blink-diff\index.js:359:16
    at D:\code\new-test\node_modules\promise\lib\es6-extensions.js:18:19
    at flush (D:\code\new-test\node_modules\asap\asap.js:27:13)
    at _combinedTickCallback (internal/process/next_tick.js:132:7)
    at process._tickCallback (internal/process/next_tick.js:181:9)
(node:8644) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:8644) UnhandledPromiseRejectionWarning: TypeError: this._loadImage is not a function
    at D:\code\new-test\node_modules\blink-diff\index.js:359:16
    at D:\code\new-test\node_modules\promise\lib\es6-extensions.js:18:19
    at flush (D:\code\new-test\node_modules\asap\asap.js:27:13)
    at _combinedTickCallback (internal/process/next_tick.js:132:7)
    at process._tickCallback (internal/process/next_tick.js:181:9)
(node:8644) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)

Process finished with exit code 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions