From dc6aab1095967bcb6e3dc61e0bf047e3f90a97be Mon Sep 17 00:00:00 2001 From: kobenguyent Date: Tue, 10 Dec 2024 17:01:36 +0100 Subject: [PATCH 1/4] feat: improve codeceptjs step logs --- packages/allure-codeceptjs/package.json | 3 ++- packages/allure-codeceptjs/src/reporter.ts | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/allure-codeceptjs/package.json b/packages/allure-codeceptjs/package.json index f7550aaa9..b0d579e94 100644 --- a/packages/allure-codeceptjs/package.json +++ b/packages/allure-codeceptjs/package.json @@ -47,7 +47,8 @@ }, "dependencies": { "allure-js-commons": "workspace:*", - "allure-mocha": "workspace:*" + "allure-mocha": "workspace:*", + "invisi-data": "^1.1.2" }, "devDependencies": { "@babel/cli": "^7.24.6", diff --git a/packages/allure-codeceptjs/src/reporter.ts b/packages/allure-codeceptjs/src/reporter.ts index 2486355c1..22fe8daa1 100644 --- a/packages/allure-codeceptjs/src/reporter.ts +++ b/packages/allure-codeceptjs/src/reporter.ts @@ -5,6 +5,7 @@ import { LabelName, Stage, Status, type StepResult } from "allure-js-commons"; import { getMessageAndTraceFromError, getStatusFromError, isMetadataTag } from "allure-js-commons/sdk"; import AllureMochaReporter from "allure-mocha"; import type { CodeceptError, CodeceptStep } from "./model.js"; +import { maskSensitiveData } from "invisi-data"; export class AllureCodeceptJsReporter extends AllureMochaReporter { constructor(runner: Mocha.Runner, opts: Mocha.MochaOptions, isInWorker: boolean) { @@ -47,7 +48,8 @@ export class AllureCodeceptJsReporter extends AllureMochaReporter { } this.runtime.startStep(root, undefined, { name: `${step.actor} ${step.name}`, - parameters: step.args?.map((arg, index) => ({ name: `arg${index}`, value: `${arg}` })), + // @ts-ignore + parameters: step.args?.map((arg, index) => ({ name: `arg${index}`, value: `${ global.maskSensitiveData ? maskSensitiveData(JSON.stringify(arg)) : JSON.stringify(arg)}` })), }); } From 7034e9a0eca67eaac87d3fb4fe97fd70a21e609f Mon Sep 17 00:00:00 2001 From: kobenguyent Date: Tue, 10 Dec 2024 17:15:21 +0100 Subject: [PATCH 2/4] remove deps in package.json --- packages/allure-codeceptjs/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/allure-codeceptjs/package.json b/packages/allure-codeceptjs/package.json index b0d579e94..f7550aaa9 100644 --- a/packages/allure-codeceptjs/package.json +++ b/packages/allure-codeceptjs/package.json @@ -47,8 +47,7 @@ }, "dependencies": { "allure-js-commons": "workspace:*", - "allure-mocha": "workspace:*", - "invisi-data": "^1.1.2" + "allure-mocha": "workspace:*" }, "devDependencies": { "@babel/cli": "^7.24.6", From 3da12f5400fda2feee85ff8ec3eeb9be6935ec6b Mon Sep 17 00:00:00 2001 From: kobenguyent Date: Tue, 10 Dec 2024 17:26:58 +0100 Subject: [PATCH 3/4] style fixes --- packages/allure-codeceptjs/src/reporter.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/allure-codeceptjs/src/reporter.ts b/packages/allure-codeceptjs/src/reporter.ts index 22fe8daa1..647c3a5b3 100644 --- a/packages/allure-codeceptjs/src/reporter.ts +++ b/packages/allure-codeceptjs/src/reporter.ts @@ -1,11 +1,12 @@ import { event, recorder } from "codeceptjs"; +// @ts-ignore +import { maskSensitiveData } from "invisi-data"; import type * as Mocha from "mocha"; import { env } from "node:process"; import { LabelName, Stage, Status, type StepResult } from "allure-js-commons"; import { getMessageAndTraceFromError, getStatusFromError, isMetadataTag } from "allure-js-commons/sdk"; import AllureMochaReporter from "allure-mocha"; import type { CodeceptError, CodeceptStep } from "./model.js"; -import { maskSensitiveData } from "invisi-data"; export class AllureCodeceptJsReporter extends AllureMochaReporter { constructor(runner: Mocha.Runner, opts: Mocha.MochaOptions, isInWorker: boolean) { @@ -49,7 +50,10 @@ export class AllureCodeceptJsReporter extends AllureMochaReporter { this.runtime.startStep(root, undefined, { name: `${step.actor} ${step.name}`, // @ts-ignore - parameters: step.args?.map((arg, index) => ({ name: `arg${index}`, value: `${ global.maskSensitiveData ? maskSensitiveData(JSON.stringify(arg)) : JSON.stringify(arg)}` })), + parameters: step.args?.map((arg, index) => ({ + name: `arg${index}`, + value: `${global.maskSensitiveData ? maskSensitiveData(JSON.stringify(arg)) : JSON.stringify(arg)}`, + })), }); } From af5f646ada28cb8aebfbdec7e7b3b48f373c3c32 Mon Sep 17 00:00:00 2001 From: kobenguyent Date: Tue, 10 Dec 2024 17:35:31 +0100 Subject: [PATCH 4/4] style fixes --- packages/allure-codeceptjs/src/reporter.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/allure-codeceptjs/src/reporter.ts b/packages/allure-codeceptjs/src/reporter.ts index 647c3a5b3..805f01bd0 100644 --- a/packages/allure-codeceptjs/src/reporter.ts +++ b/packages/allure-codeceptjs/src/reporter.ts @@ -49,10 +49,9 @@ export class AllureCodeceptJsReporter extends AllureMochaReporter { } this.runtime.startStep(root, undefined, { name: `${step.actor} ${step.name}`, - // @ts-ignore parameters: step.args?.map((arg, index) => ({ name: `arg${index}`, - value: `${global.maskSensitiveData ? maskSensitiveData(JSON.stringify(arg)) : JSON.stringify(arg)}`, + value: `${(global as any).maskSensitiveData ? maskSensitiveData(JSON.stringify(arg)) : JSON.stringify(arg)}`, })), }); }