@wdio/reporter
Advanced tools
Comparing version 9.4.3 to 9.4.4
@@ -10,3 +10,3 @@ import type { WriteStream } from 'node:fs'; | ||
type CustomWriteStream = { | ||
write: (content: any) => boolean; | ||
write: (content: unknown) => boolean; | ||
}; | ||
@@ -43,22 +43,22 @@ export default class WDIOReporter extends EventEmitter { | ||
*/ | ||
write(content: any): void; | ||
onRunnerStart(runnerStats: RunnerStats): void; | ||
onBeforeCommand(commandArgs: BeforeCommandArgs): void; | ||
onAfterCommand(commandArgs: AfterCommandArgs): void; | ||
onBeforeAssertion(assertionArgs: unknown): void; | ||
onAfterAssertion(assertionArgs: unknown): void; | ||
onSuiteStart(suiteStats: SuiteStats): void; | ||
onHookStart(hookStat: HookStats): void; | ||
onHookEnd(hookStats: HookStats): void; | ||
onTestStart(testStats: TestStats): void; | ||
onTestPass(testStats: TestStats): void; | ||
onTestFail(testStats: TestStats): void; | ||
onTestRetry(testStats: TestStats): void; | ||
onTestSkip(testStats: TestStats): void; | ||
onTestEnd(testStats: TestStats): void; | ||
onSuiteRetry(suiteStats: SuiteStats): void; | ||
onSuiteEnd(suiteStats: SuiteStats): void; | ||
onRunnerEnd(runnerStats: RunnerStats): void; | ||
write(content: unknown): void; | ||
onRunnerStart(_runnerStats: RunnerStats): void; | ||
onBeforeCommand(_commandArgs: BeforeCommandArgs): void; | ||
onAfterCommand(_commandArgs: AfterCommandArgs): void; | ||
onBeforeAssertion(_assertionArgs: unknown): void; | ||
onAfterAssertion(_assertionArgs: unknown): void; | ||
onSuiteStart(_suiteStats: SuiteStats): void; | ||
onHookStart(_hookStat: HookStats): void; | ||
onHookEnd(_hookStats: HookStats): void; | ||
onTestStart(_testStats: TestStats): void; | ||
onTestPass(_testStats: TestStats): void; | ||
onTestFail(_testStats: TestStats): void; | ||
onTestRetry(_testStats: TestStats): void; | ||
onTestSkip(_testStats: TestStats): void; | ||
onTestEnd(_testStats: TestStats): void; | ||
onSuiteRetry(_suiteStats: SuiteStats): void; | ||
onSuiteEnd(_suiteStats: SuiteStats): void; | ||
onRunnerEnd(_runnerStats: RunnerStats): void; | ||
} | ||
export { SuiteStats, Tag, HookStats, TestStats, RunnerStats, BeforeCommandArgs, AfterCommandArgs, CommandArgs, Argument, Test }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -9,3 +9,3 @@ // src/index.ts | ||
import tty from "node:tty"; | ||
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process.argv) { | ||
function hasFlag(flag, argv = process.argv) { | ||
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--"; | ||
@@ -464,28 +464,20 @@ const position = argv.indexOf(prefix + flag); | ||
this.on("client:afterAssertion", this.onAfterAssertion.bind(this)); | ||
this.on( | ||
"runner:start", | ||
/* istanbul ignore next */ | ||
(runner) => { | ||
rootSuite.cid = runner.cid; | ||
this.specs.push(...runner.specs); | ||
this.runnerStat = new RunnerStats(runner); | ||
this.onRunnerStart(this.runnerStat); | ||
this.on("runner:start", (runner) => { | ||
rootSuite.cid = runner.cid; | ||
this.specs.push(...runner.specs); | ||
this.runnerStat = new RunnerStats(runner); | ||
this.onRunnerStart(this.runnerStat); | ||
}); | ||
this.on("suite:start", (params) => { | ||
if (!params.file) { | ||
params.file = !params.parent ? this.specs.shift() || "unknown spec file" : this.currentSpec; | ||
this.currentSpec = params.file; | ||
} | ||
); | ||
this.on( | ||
"suite:start", | ||
/* istanbul ignore next */ | ||
(params) => { | ||
if (!params.file) { | ||
params.file = !params.parent ? this.specs.shift() || "unknown spec file" : this.currentSpec; | ||
this.currentSpec = params.file; | ||
} | ||
const suite = new SuiteStats(params); | ||
const currentSuite = this.currentSuites[this.currentSuites.length - 1]; | ||
currentSuite.suites.push(suite); | ||
this.currentSuites.push(suite); | ||
this.suites[suite.uid] = suite; | ||
this.onSuiteStart(suite); | ||
} | ||
); | ||
const suite = new SuiteStats(params); | ||
const currentSuite = this.currentSuites[this.currentSuites.length - 1]; | ||
currentSuite.suites.push(suite); | ||
this.currentSuites.push(suite); | ||
this.suites[suite.uid] = suite; | ||
this.onSuiteStart(suite); | ||
}); | ||
this.on("suite:retry", (suite) => { | ||
@@ -496,48 +488,32 @@ const suiteStat = this.suites[suite.uid]; | ||
}); | ||
this.on( | ||
"hook:start", | ||
/* istanbul ignore next */ | ||
(hook) => { | ||
const hookStats = new HookStats(hook); | ||
const currentSuite = this.currentSuites[this.currentSuites.length - 1]; | ||
currentSuite.hooks.push(hookStats); | ||
currentSuite.hooksAndTests.push(hookStats); | ||
this.hooks[hook.uid] = hookStats; | ||
this.onHookStart(hookStats); | ||
} | ||
); | ||
this.on( | ||
"hook:end", | ||
/* istanbul ignore next */ | ||
(hook) => { | ||
const hookStats = this.hooks[hook.uid]; | ||
hookStats.complete(getErrorsFromEvent(hook)); | ||
this.counts.hooks++; | ||
this.onHookEnd(hookStats); | ||
} | ||
); | ||
this.on( | ||
"test:start", | ||
/* istanbul ignore next */ | ||
(test) => { | ||
test.retries = this.retries; | ||
currentTest = new TestStats(test); | ||
const currentSuite = this.currentSuites[this.currentSuites.length - 1]; | ||
currentSuite.tests.push(currentTest); | ||
currentSuite.hooksAndTests.push(currentTest); | ||
this.tests[test.uid] = currentTest; | ||
this.onTestStart(currentTest); | ||
} | ||
); | ||
this.on( | ||
"test:pass", | ||
/* istanbul ignore next */ | ||
(test) => { | ||
const testStat = this.tests[test.uid]; | ||
testStat.pass(); | ||
this.counts.passes++; | ||
this.counts.tests++; | ||
this.onTestPass(testStat); | ||
} | ||
); | ||
this.on("hook:start", (hook) => { | ||
const hookStats = new HookStats(hook); | ||
const currentSuite = this.currentSuites[this.currentSuites.length - 1]; | ||
currentSuite.hooks.push(hookStats); | ||
currentSuite.hooksAndTests.push(hookStats); | ||
this.hooks[hook.uid] = hookStats; | ||
this.onHookStart(hookStats); | ||
}); | ||
this.on("hook:end", (hook) => { | ||
const hookStats = this.hooks[hook.uid]; | ||
hookStats.complete(getErrorsFromEvent(hook)); | ||
this.counts.hooks++; | ||
this.onHookEnd(hookStats); | ||
}); | ||
this.on("test:start", (test) => { | ||
test.retries = this.retries; | ||
currentTest = new TestStats(test); | ||
const currentSuite = this.currentSuites[this.currentSuites.length - 1]; | ||
currentSuite.tests.push(currentTest); | ||
currentSuite.hooksAndTests.push(currentTest); | ||
this.tests[test.uid] = currentTest; | ||
this.onTestStart(currentTest); | ||
}); | ||
this.on("test:pass", (test) => { | ||
const testStat = this.tests[test.uid]; | ||
testStat.pass(); | ||
this.counts.passes++; | ||
this.counts.tests++; | ||
this.onTestPass(testStat); | ||
}); | ||
this.on("test:skip", (test) => { | ||
@@ -550,13 +526,9 @@ const testStat = this.tests[test.uid]; | ||
}); | ||
this.on( | ||
"test:fail", | ||
/* istanbul ignore next */ | ||
(test) => { | ||
const testStat = this.tests[test.uid]; | ||
testStat.fail(getErrorsFromEvent(test)); | ||
this.counts.failures++; | ||
this.counts.tests++; | ||
this.onTestFail(testStat); | ||
} | ||
); | ||
this.on("test:fail", (test) => { | ||
const testStat = this.tests[test.uid]; | ||
testStat.fail(getErrorsFromEvent(test)); | ||
this.counts.failures++; | ||
this.counts.tests++; | ||
this.onTestFail(testStat); | ||
}); | ||
this.on("test:retry", (test) => { | ||
@@ -589,70 +561,50 @@ const testStat = this.tests[test.uid]; | ||
}); | ||
this.on( | ||
"test:end", | ||
/* istanbul ignore next */ | ||
(test) => { | ||
const testStat = this.tests[test.uid]; | ||
this.retries = 0; | ||
this.onTestEnd(testStat); | ||
this.on("test:end", (test) => { | ||
const testStat = this.tests[test.uid]; | ||
this.retries = 0; | ||
this.onTestEnd(testStat); | ||
}); | ||
this.on("suite:end", (suite) => { | ||
const suiteStat = this.suites[suite.uid]; | ||
suiteStat.complete(); | ||
this.currentSuites.pop(); | ||
this.onSuiteEnd(suiteStat); | ||
}); | ||
this.on("runner:end", (runner) => { | ||
rootSuite.complete(); | ||
if (this.runnerStat) { | ||
this.runnerStat.failures = runner.failures; | ||
this.runnerStat.retries = runner.retries; | ||
this.runnerStat.complete(); | ||
this.onRunnerEnd(this.runnerStat); | ||
} | ||
); | ||
this.on( | ||
"suite:end", | ||
/* istanbul ignore next */ | ||
(suite) => { | ||
const suiteStat = this.suites[suite.uid]; | ||
suiteStat.complete(); | ||
this.currentSuites.pop(); | ||
this.onSuiteEnd(suiteStat); | ||
const logFile = this.options.logFile; | ||
if (!this.isContentPresent && logFile && fs.existsSync(logFile)) { | ||
fs.unlinkSync(logFile); | ||
} | ||
); | ||
this.on( | ||
"runner:end", | ||
/* istanbul ignore next */ | ||
(runner) => { | ||
rootSuite.complete(); | ||
if (this.runnerStat) { | ||
this.runnerStat.failures = runner.failures; | ||
this.runnerStat.retries = runner.retries; | ||
this.runnerStat.complete(); | ||
this.onRunnerEnd(this.runnerStat); | ||
} | ||
const logFile = this.options.logFile; | ||
if (!this.isContentPresent && logFile && fs.existsSync(logFile)) { | ||
fs.unlinkSync(logFile); | ||
} | ||
}); | ||
this.on("client:beforeCommand", (payload) => { | ||
if (!currentTest) { | ||
return; | ||
} | ||
); | ||
this.on( | ||
"client:beforeCommand", | ||
/* istanbul ignore next */ | ||
(payload) => { | ||
if (!currentTest) { | ||
return; | ||
} | ||
if (payload.body?.script) { | ||
payload.body = { | ||
...payload.body, | ||
script: transformCommandScript(payload.body.script) | ||
}; | ||
} | ||
currentTest.output.push(Object.assign(payload, { type: "command" })); | ||
if (payload.body?.script) { | ||
payload.body = { | ||
...payload.body, | ||
script: transformCommandScript(payload.body.script) | ||
}; | ||
} | ||
); | ||
this.on( | ||
"client:afterCommand", | ||
/* istanbul ignore next */ | ||
(payload) => { | ||
if (!currentTest) { | ||
return; | ||
} | ||
if (payload.body?.script) { | ||
payload.body = { | ||
...payload.body, | ||
script: transformCommandScript(payload.body.script) | ||
}; | ||
} | ||
currentTest.output.push(Object.assign(payload, { type: "result" })); | ||
currentTest.output.push(Object.assign(payload, { type: "command" })); | ||
}); | ||
this.on("client:afterCommand", (payload) => { | ||
if (!currentTest) { | ||
return; | ||
} | ||
); | ||
if (payload.body?.script) { | ||
payload.body = { | ||
...payload.body, | ||
script: transformCommandScript(payload.body.script) | ||
}; | ||
} | ||
currentTest.output.push(Object.assign(payload, { type: "result" })); | ||
}); | ||
} | ||
@@ -694,69 +646,35 @@ outputStream; | ||
} | ||
/* istanbul ignore next */ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
onRunnerStart(runnerStats) { | ||
onRunnerStart(_runnerStats) { | ||
} | ||
/* istanbul ignore next */ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
onBeforeCommand(commandArgs) { | ||
onBeforeCommand(_commandArgs) { | ||
} | ||
/* istanbul ignore next */ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
onAfterCommand(commandArgs) { | ||
onAfterCommand(_commandArgs) { | ||
} | ||
/* istanbul ignore next */ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
onBeforeAssertion(assertionArgs) { | ||
onBeforeAssertion(_assertionArgs) { | ||
} | ||
/* istanbul ignore next */ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
onAfterAssertion(assertionArgs) { | ||
onAfterAssertion(_assertionArgs) { | ||
} | ||
/* istanbul ignore next */ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
onSuiteStart(suiteStats) { | ||
onSuiteStart(_suiteStats) { | ||
} | ||
/* istanbul ignore next */ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
onHookStart(hookStat) { | ||
onHookStart(_hookStat) { | ||
} | ||
/* istanbul ignore next */ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
onHookEnd(hookStats) { | ||
onHookEnd(_hookStats) { | ||
} | ||
/* istanbul ignore next */ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
onTestStart(testStats) { | ||
onTestStart(_testStats) { | ||
} | ||
/* istanbul ignore next */ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
onTestPass(testStats) { | ||
onTestPass(_testStats) { | ||
} | ||
/* istanbul ignore next */ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
onTestFail(testStats) { | ||
onTestFail(_testStats) { | ||
} | ||
/* istanbul ignore next */ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
onTestRetry(testStats) { | ||
onTestRetry(_testStats) { | ||
} | ||
/* istanbul ignore next */ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
onTestSkip(testStats) { | ||
onTestSkip(_testStats) { | ||
} | ||
/* istanbul ignore next */ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
onTestEnd(testStats) { | ||
onTestEnd(_testStats) { | ||
} | ||
/* istanbul ignore next */ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
onSuiteRetry(suiteStats) { | ||
onSuiteRetry(_suiteStats) { | ||
} | ||
/* istanbul ignore next */ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
onSuiteEnd(suiteStats) { | ||
onSuiteEnd(_suiteStats) { | ||
} | ||
/* istanbul ignore next */ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
onRunnerEnd(runnerStats) { | ||
onRunnerEnd(_runnerStats) { | ||
} | ||
@@ -763,0 +681,0 @@ }; |
@@ -23,3 +23,3 @@ import RunnableStats from './runnable.js'; | ||
command: string; | ||
params: any; | ||
params: unknown[]; | ||
method: 'PUT' | 'POST' | 'GET' | 'DELETE'; | ||
@@ -26,0 +26,0 @@ endpoint: string; |
@@ -6,5 +6,2 @@ /** | ||
*/ | ||
declare global { | ||
var Deno: any; | ||
} | ||
interface Options { | ||
@@ -11,0 +8,0 @@ /** |
@@ -14,9 +14,9 @@ export interface Tag { | ||
command?: string; | ||
params?: any; | ||
params?: unknown; | ||
} | ||
export interface BeforeCommandArgs extends CommandArgs { | ||
body: any; | ||
body: unknown; | ||
} | ||
export interface AfterCommandArgs extends CommandArgs { | ||
result: any; | ||
result: unknown; | ||
/** | ||
@@ -23,0 +23,0 @@ * custom commands also send along the command name |
@@ -22,5 +22,5 @@ import { COLORS } from './constants.js'; | ||
export declare function getErrorsFromEvent(e: { | ||
errors?: any; | ||
error?: any; | ||
}): any; | ||
errors?: Error[]; | ||
error?: Error; | ||
}): Error[]; | ||
/** | ||
@@ -27,0 +27,0 @@ * Pads the given `str` to `len`. |
{ | ||
"name": "@wdio/reporter", | ||
"version": "9.4.3", | ||
"version": "9.4.4", | ||
"description": "A WebdriverIO utility to help reporting all events", | ||
@@ -41,4 +41,4 @@ "author": "Christian Bromann <mail@bromann.dev>", | ||
"@types/node": "^20.1.0", | ||
"@wdio/logger": "9.1.3", | ||
"@wdio/types": "9.4.3", | ||
"@wdio/logger": "9.4.4", | ||
"@wdio/types": "9.4.4", | ||
"diff": "^7.0.0", | ||
@@ -54,3 +54,3 @@ "object-inspect": "^1.12.0" | ||
}, | ||
"gitHead": "8ee63eaefd86cf06eea832bb8d4c1920e9cc4e55" | ||
"gitHead": "d327d86e07d16eaa0ecdf0656c1868ba73261393" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
73777
1763
+ Added@wdio/logger@9.4.4(transitive)
+ Added@wdio/types@9.4.4(transitive)
- Removed@wdio/logger@9.1.3(transitive)
- Removed@wdio/types@9.4.3(transitive)
Updated@wdio/logger@9.4.4
Updated@wdio/types@9.4.4