Skip to content

Fixed "this.resolveImagePathRelativeFromReport is not a function" #119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@ declare class ResembleHelper {
screenshotFolder: string;
prepareBaseImage: any;
resolvePath(folderPath: any): any;
_resolveRelativePath(folderPath: any): any;
/**
* Compare Images
*
* @param image
* @param options
* @returns {Promise<resolve | reject>}
*/
_compareImages(image: any, options: any): Promise<any | any>;
_compareImages(image: any, options: any): Promise<resolve | reject>;
/**
*
* @param image
Expand Down
12 changes: 6 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class ResembleHelper extends Helper {
absolutePathOfReportFolder = Container.mocha().options.reporterOptions.reportDir;
}
// support mocha-multi-reporters
if (Container.mocha() && typeof Container.mocha().options.reporterOptions.mochawesomeReporterOptions.reportDir !== 'undefined') {
if (Container.mocha() && typeof Container.mocha().options.reporterOptions.mochawesomeReporterOptions?.reportDir !== 'undefined') {
absolutePathOfReportFolder = Container.mocha().options.reporterOptions.mochawesomeReporterOptions.reportDir;
}
return path.relative(absolutePathOfReportFolder, absolutePathOfImage);
Expand Down Expand Up @@ -191,11 +191,11 @@ class ResembleHelper extends Helper {

if (mocha !== undefined && misMatch >= options.tolerance) {
await mocha.addMochawesomeContext("Base Image");
await mocha.addMochawesomeContext(this.resolveImagePathRelativeFromReport(this._getBaseImagePath(baseImage, options)));
await mocha.addMochawesomeContext(this._resolveRelativePath(this._getBaseImagePath(baseImage, options)));
await mocha.addMochawesomeContext("ScreenShot Image");
await mocha.addMochawesomeContext(this.resolveImagePathRelativeFromReport(this._getActualImagePath(baseImage)));
await mocha.addMochawesomeContext(this._resolveRelativePath(this._getActualImagePath(baseImage)));
await mocha.addMochawesomeContext("Diff Image");
await mocha.addMochawesomeContext(this.resolveImagePathRelativeFromReport(this._getDiffImagePath(baseImage)));
await mocha.addMochawesomeContext(this._resolveRelativePath(this._getDiffImagePath(baseImage)));
}
}

Expand Down Expand Up @@ -344,8 +344,8 @@ class ResembleHelper extends Helper {
options.boundingBox = await this._getBoundingBox(selector);
}
const misMatch = await this._fetchMisMatchPercentage(baseImage, options);
this._addAttachment(baseImage, misMatch, options);
this._addMochaContext(baseImage, misMatch, options);
await this._addAttachment(baseImage, misMatch, options);
await this._addMochaContext(baseImage, misMatch, options);
if (awsC !== undefined) {
await this._upload(awsC.accessKeyId, awsC.secretAccessKey, awsC.region, awsC.bucketName, baseImage, options)
}
Expand Down