Skip to content

Commit

Permalink
fix(ci): enable lint check (#136)
Browse files Browse the repository at this point in the history
* fix(ci): enable lint check

* fix: GHA

* fix: lint issue
  • Loading branch information
kobenguyent authored Jan 23, 2024
1 parent 14568fa commit 903191f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 17 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ jobs:
run: |
npm i && npx playwright install chromium
npm test
- name: lint check
run: |
npm i
npm run lint
- name: Build
run: |
npm i
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"build": "tsc",
"lint": "rome ci src",
"format": "rome format src --write",
"lint:fix": "rome check src --apply-suggested",
"lint:fix": "rome check src --apply-unsafe",
"test": "jest --coverage"
},
"dependencies": {
Expand Down
32 changes: 16 additions & 16 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { Helper } = require('codeceptjs');
const { Helper } = require("codeceptjs");
const resemble = require("resemblejs");
const fs = require("fs");
const assert = require("assert");
Expand Down Expand Up @@ -30,7 +30,7 @@ interface Options {
needsSameDimension?: boolean;
outputSettings?: any;
prepareBaseImage?: boolean;
compareWithImage?: any
compareWithImage?: any;
}

interface Endpoint {
Expand Down Expand Up @@ -69,7 +69,7 @@ class ResembleHelper extends Helper {
outputDir = require("codeceptjs").config.get().output || "output";
this.baseFolder = this.resolvePath(config.baseFolder);
this.diffFolder = this.resolvePath(config.diffFolder);
this.screenshotFolder = this.resolvePath(config.screenshotFolder || 'output');
this.screenshotFolder = this.resolvePath(config.screenshotFolder || "output");
this.prepareBaseImage = config.prepareBaseImage;
}

Expand Down Expand Up @@ -230,7 +230,7 @@ class ResembleHelper extends Helper {
*/

async _addAttachment(baseImage: any, misMatch: any, options: Options) {
const allure: any = require('codeceptjs').container.plugins("allure");
const allure: any = require("codeceptjs").container.plugins("allure");

if (allure !== undefined && misMatch >= options.tolerance) {
allure.addAttachment("Base Image", fs.readFileSync(this._getBaseImagePath(baseImage, options)), "image/png");
Expand Down Expand Up @@ -559,25 +559,25 @@ class ResembleHelper extends Helper {
}

_getHelper() {
if (this.helpers['Puppeteer']) {
return this.helpers['Puppeteer'];
if (this.helpers["Puppeteer"]) {
return this.helpers["Puppeteer"];
}

if (this.helpers['WebDriver']) {
return this.helpers['WebDriver'];
if (this.helpers["WebDriver"]) {
return this.helpers["WebDriver"];
}
if (this.helpers['Appium']) {
return this.helpers['Appium'];
if (this.helpers["Appium"]) {
return this.helpers["Appium"];
}
if (this.helpers['WebDriverIO']) {
return this.helpers['WebDriverIO'];
if (this.helpers["WebDriverIO"]) {
return this.helpers["WebDriverIO"];
}
if (this.helpers['TestCafe']) {
return this.helpers['TestCafe'];
if (this.helpers["TestCafe"]) {
return this.helpers["TestCafe"];
}

if (this.helpers['Playwright']) {
return this.helpers['Playwright'];
if (this.helpers["Playwright"]) {
return this.helpers["Playwright"];
}

throw Error(`No matching helper found. Supported helpers: ${supportedHelper.join("/")}`);
Expand Down

0 comments on commit 903191f

Please sign in to comment.