From 903191f1fbfc26905831f07181e3da90e77fc5f3 Mon Sep 17 00:00:00 2001 From: KobeN <7845001+kobenguyent@users.noreply.github.com> Date: Tue, 23 Jan 2024 09:37:48 +0100 Subject: [PATCH] fix(ci): enable lint check (#136) * fix(ci): enable lint check * fix: GHA * fix: lint issue --- .github/workflows/test.yml | 4 ++++ package.json | 2 +- src/index.ts | 32 ++++++++++++++++---------------- 3 files changed, 21 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fa91f65..ed4ded8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/package.json b/package.json index b22da57..8e840c8 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/index.ts b/src/index.ts index 7ccf93d..99120fd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -const { Helper } = require('codeceptjs'); +const { Helper } = require("codeceptjs"); const resemble = require("resemblejs"); const fs = require("fs"); const assert = require("assert"); @@ -30,7 +30,7 @@ interface Options { needsSameDimension?: boolean; outputSettings?: any; prepareBaseImage?: boolean; - compareWithImage?: any + compareWithImage?: any; } interface Endpoint { @@ -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; } @@ -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"); @@ -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("/")}`);