From 899b770e088fbbf24246f594659eae966efc1bda Mon Sep 17 00:00:00 2001 From: epszaw Date: Mon, 20 May 2024 20:12:18 +0200 Subject: [PATCH] fix linters issues --- packages/allure-cucumberjs/src/index.ts | 4 +--- packages/allure-cucumberjs/src/reporter.ts | 6 +++--- packages/allure-cucumberjs/src/runtime.ts | 4 ++-- .../test/fixtures/support/runtime/legacy/description.cjs | 2 +- .../test/fixtures/support/runtime/legacy/links.cjs | 6 +++--- packages/allure-cucumberjs/test/spec/simple.test.ts | 2 -- packages/allure-cucumberjs/test/utils.ts | 8 ++++++-- packages/allure-js-commons/src/TestRuntime.ts | 1 - 8 files changed, 16 insertions(+), 17 deletions(-) diff --git a/packages/allure-cucumberjs/src/index.ts b/packages/allure-cucumberjs/src/index.ts index 534091eb4..02968c2f1 100644 --- a/packages/allure-cucumberjs/src/index.ts +++ b/packages/allure-cucumberjs/src/index.ts @@ -1,7 +1,5 @@ import { Before } from "@cucumber/cucumber"; -import { - setGlobalTestRuntime, -} from "allure-js-commons/sdk/node"; +import { setGlobalTestRuntime } from "allure-js-commons/sdk/node"; import { AllureCucumberTestRuntime } from "./runtime.js"; Before(function () { diff --git a/packages/allure-cucumberjs/src/reporter.ts b/packages/allure-cucumberjs/src/reporter.ts index 4dce765cd..476630d37 100644 --- a/packages/allure-cucumberjs/src/reporter.ts +++ b/packages/allure-cucumberjs/src/reporter.ts @@ -1,4 +1,4 @@ -import { World, Formatter, IFormatterOptions, TestCaseHookDefinition, setWorldConstructor } from "@cucumber/cucumber"; +import { Formatter, IFormatterOptions, TestCaseHookDefinition, World } from "@cucumber/cucumber"; import * as messages from "@cucumber/messages"; import { PickleTag, Tag, TestStepResult, TestStepResultStatus } from "@cucumber/messages"; import os from "node:os"; @@ -19,8 +19,8 @@ import { createStepResult, getWorstStepResultStatus, } from "allure-js-commons/sdk/node"; -import { AllureCucumberTestRuntime } from "./runtime.js"; import { AllureCucumberReporterConfig, LabelConfig, LinkConfig } from "./model.js"; +import { AllureCucumberTestRuntime } from "./runtime.js"; const { ALLURE_THREAD_NAME } = process.env; @@ -76,7 +76,7 @@ export default class AllureCucumberReporter extends Formatter { // set custom Allure World for single thread mode if (options.supportCodeLibrary.World === World) { // @ts-ignore - options.supportCodeLibrary.World = AllureCucumberTestRuntime + options.supportCodeLibrary.World = AllureCucumberTestRuntime; } } diff --git a/packages/allure-cucumberjs/src/runtime.ts b/packages/allure-cucumberjs/src/runtime.ts index a4a0e19ea..164e5a9c7 100644 --- a/packages/allure-cucumberjs/src/runtime.ts +++ b/packages/allure-cucumberjs/src/runtime.ts @@ -167,7 +167,7 @@ export class AllureCucumberTestRuntime extends World implements TestRuntime { } issue(url: string, name: string) { - this.link(url, LinkType.ISSUE, name) + this.link(url, LinkType.ISSUE, name); } tms(url: string, name: string) { @@ -220,7 +220,7 @@ export class AllureCucumberTestRuntime extends World implements TestRuntime { tags(...tagsList: string[]) { this.labels(...tagsList.map((value) => ({ name: LabelName.TAG, value }))); - }; + } async stepDisplayName() {} diff --git a/packages/allure-cucumberjs/test/fixtures/support/runtime/legacy/description.cjs b/packages/allure-cucumberjs/test/fixtures/support/runtime/legacy/description.cjs index e3794e3c0..1679521ea 100644 --- a/packages/allure-cucumberjs/test/fixtures/support/runtime/legacy/description.cjs +++ b/packages/allure-cucumberjs/test/fixtures/support/runtime/legacy/description.cjs @@ -1,5 +1,5 @@ const { setWorldConstructor, Given } = require("@cucumber/cucumber"); -const { CucumberAllureWorld } = require("allure-cucumberjs") +const { CucumberAllureWorld } = require("allure-cucumberjs"); Given("a step", () => {}); diff --git a/packages/allure-cucumberjs/test/fixtures/support/runtime/legacy/links.cjs b/packages/allure-cucumberjs/test/fixtures/support/runtime/legacy/links.cjs index 35390cca7..29c954a01 100644 --- a/packages/allure-cucumberjs/test/fixtures/support/runtime/legacy/links.cjs +++ b/packages/allure-cucumberjs/test/fixtures/support/runtime/legacy/links.cjs @@ -2,16 +2,16 @@ const { Given } = require("@cucumber/cucumber"); Given("a step", () => {}); -Given("a step with runtime link", async function() { +Given("a step with runtime link", async function () { await this.link("https://example.com", "custom", "Custom link"); }); -Given("a step with runtime issue links", async function() { +Given("a step with runtime issue links", async function () { await this.issue("https://example.com/issues/1", "Custom issue 1"); await this.issue("2", "Custom issue 2"); }); -Given("a step with runtime tms links", async function() { +Given("a step with runtime tms links", async function () { await this.tms("https://example.com/tasks/1", "Custom task 1"); await this.tms("2", "Custom task 2"); }); diff --git a/packages/allure-cucumberjs/test/spec/simple.test.ts b/packages/allure-cucumberjs/test/spec/simple.test.ts index 006384013..85611e40a 100644 --- a/packages/allure-cucumberjs/test/spec/simple.test.ts +++ b/packages/allure-cucumberjs/test/spec/simple.test.ts @@ -5,8 +5,6 @@ import { runCucumberInlineTest } from "../utils"; it("handles basic cases", async () => { const { tests } = await runCucumberInlineTest(["simple"], ["simple"]); - debugger - expect(tests).toHaveLength(3); expect(tests).toContainEqual( expect.objectContaining({ diff --git a/packages/allure-cucumberjs/test/utils.ts b/packages/allure-cucumberjs/test/utils.ts index 133886caf..9b25c83e8 100644 --- a/packages/allure-cucumberjs/test/utils.ts +++ b/packages/allure-cucumberjs/test/utils.ts @@ -1,10 +1,14 @@ import { fork } from "node:child_process"; import { randomUUID } from "node:crypto"; import { copyFile, mkdir, rm, writeFile } from "node:fs/promises"; -import { join, resolve as resolvePath, dirname } from "node:path"; +import { dirname, join, resolve as resolvePath } from "node:path"; import { AllureResults, TestResult, TestResultContainer } from "allure-js-commons/sdk"; -export const runCucumberInlineTest = async (features: string[], stepsDefs: string[], parallel: boolean = true): Promise => { +export const runCucumberInlineTest = async ( + features: string[], + stepsDefs: string[], + parallel: boolean = true, +): Promise => { const res: AllureResults = { tests: [], groups: [], diff --git a/packages/allure-js-commons/src/TestRuntime.ts b/packages/allure-js-commons/src/TestRuntime.ts index eea134ed8..676d66a4c 100644 --- a/packages/allure-js-commons/src/TestRuntime.ts +++ b/packages/allure-js-commons/src/TestRuntime.ts @@ -1,5 +1,4 @@ import * as Buffer from "node:buffer"; -import { env } from "node:process"; import { ContentType, Label, Link, ParameterMode, ParameterOptions } from "./model.js"; export const ALLURE_TEST_RUNTIME_KEY = "allureTestRuntime";