@wdio/reporter
Advanced tools
Comparing version 6.6.6 to 6.7.0
/// <reference types="node" /> | ||
import { WriteStream } from 'fs'; | ||
import { EventEmitter } from 'events'; | ||
import SuiteStats from './stats/suite'; | ||
import HookStats from './stats/hook'; | ||
import TestStats from './stats/test'; | ||
import RunnerStats from './stats/runner'; | ||
import { AfterCommandArgs, BeforeCommandArgs } from './types'; | ||
interface WDIOReporterBaseOptions { | ||
outputDir?: string; | ||
} | ||
export interface WDIOReporterOptionsFromStdout extends WDIOReporterBaseOptions { | ||
stdout: boolean; | ||
writeStream: WriteStream; | ||
} | ||
export interface WDIOReporterOptionsFromLogFile extends WDIOReporterBaseOptions { | ||
logFile: string; | ||
} | ||
export declare type WDIOReporterOptions = WDIOReporterOptionsFromLogFile | WDIOReporterOptionsFromStdout; | ||
export default class WDIOReporter extends EventEmitter { | ||
constructor(options: any); | ||
options: any; | ||
outputStream: any; | ||
failures: any[]; | ||
suites: {}; | ||
hooks: {}; | ||
tests: {}; | ||
options: WDIOReporterOptions; | ||
outputStream: WriteStream; | ||
failures: number; | ||
suites: Record<string, SuiteStats>; | ||
hooks: Record<string, HookStats>; | ||
tests: Record<string, TestStats>; | ||
currentSuites: SuiteStats[]; | ||
@@ -20,24 +37,22 @@ counts: { | ||
retries: number; | ||
runnerStat: RunnerStats; | ||
runnerStat?: RunnerStats; | ||
constructor(options: WDIOReporterOptions); | ||
get isSynchronised(): boolean; | ||
write(content: any): void; | ||
onRunnerStart(): void; | ||
onBeforeCommand(): void; | ||
onAfterCommand(): void; | ||
onScreenshot(): void; | ||
onSuiteStart(): void; | ||
onHookStart(): void; | ||
onHookEnd(): void; | ||
onTestStart(): void; | ||
onTestPass(): void; | ||
onTestFail(): void; | ||
onTestRetry(): void; | ||
onTestSkip(): void; | ||
onTestEnd(): void; | ||
onSuiteEnd(): void; | ||
onRunnerEnd(): void; | ||
onRunnerStart(runnerStats: RunnerStats): void; | ||
onBeforeCommand(commandArgs: BeforeCommandArgs): void; | ||
onAfterCommand(commandArgs: AfterCommandArgs): 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; | ||
onSuiteEnd(suiteStats: SuiteStats): void; | ||
onRunnerEnd(runnerStats: RunnerStats): void; | ||
} | ||
import EventEmitter from "events"; | ||
import SuiteStats from "./stats/suite"; | ||
import RunnerStats from "./stats/runner"; | ||
export {}; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -6,5 +6,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const fs_1 = __importDefault(require("fs")); | ||
const fs_extra_1 = __importDefault(require("fs-extra")); | ||
const events_1 = __importDefault(require("events")); | ||
const fs_extra_1 = require("fs-extra"); | ||
const events_1 = require("events"); | ||
const utils_1 = require("./utils"); | ||
@@ -15,13 +14,7 @@ const suite_1 = __importDefault(require("./stats/suite")); | ||
const runner_1 = __importDefault(require("./stats/runner")); | ||
class WDIOReporter extends events_1.default { | ||
class WDIOReporter extends events_1.EventEmitter { | ||
constructor(options) { | ||
super(); | ||
this.options = options; | ||
if (this.options.outputDir) { | ||
fs_extra_1.default.ensureDirSync(this.options.outputDir); | ||
} | ||
this.outputStream = this.options.stdout || !this.options.logFile | ||
? options.writeStream | ||
: fs_1.default.createWriteStream(this.options.logFile); | ||
this.failures = []; | ||
this.failures = 0; | ||
this.suites = {}; | ||
@@ -40,2 +33,8 @@ this.hooks = {}; | ||
this.retries = 0; | ||
if (this.options.outputDir) { | ||
fs_extra_1.ensureDirSync(this.options.outputDir); | ||
} | ||
this.outputStream = this.options.stdout || !this.options.logFile | ||
? this.options.writeStream | ||
: fs_extra_1.createWriteStream(this.options.logFile); | ||
let currentTest; | ||
@@ -63,14 +62,14 @@ const rootSuite = new suite_1.default({ | ||
this.on('hook:start', (hook) => { | ||
const hookStat = new hook_1.default(hook); | ||
const hookStats = new hook_1.default(hook); | ||
const currentSuite = this.currentSuites[this.currentSuites.length - 1]; | ||
currentSuite.hooks.push(hookStat); | ||
currentSuite.hooksAndTests.push(hookStat); | ||
this.hooks[hook.uid] = hookStat; | ||
this.onHookStart(hookStat); | ||
currentSuite.hooks.push(hookStats); | ||
currentSuite.hooksAndTests.push(hookStats); | ||
this.hooks[hook.uid] = hookStats; | ||
this.onHookStart(hookStats); | ||
}); | ||
this.on('hook:end', (hook) => { | ||
const hookStat = this.hooks[hook.uid]; | ||
hookStat.complete(utils_1.getErrorsFromEvent(hook)); | ||
const hookStats = this.hooks[hook.uid]; | ||
hookStats.complete(utils_1.getErrorsFromEvent(hook)); | ||
this.counts.hooks++; | ||
this.onHookEnd(hookStat); | ||
this.onHookEnd(hookStats); | ||
}); | ||
@@ -141,6 +140,8 @@ this.on('test:start', (test) => { | ||
rootSuite.complete(); | ||
this.runnerStat.failures = runner.failures; | ||
this.runnerStat.retries = runner.retries; | ||
this.runnerStat.complete(); | ||
this.onRunnerEnd(this.runnerStat); | ||
if (this.runnerStat) { | ||
this.runnerStat.failures = runner.failures; | ||
this.runnerStat.retries = runner.retries; | ||
this.runnerStat.complete(); | ||
this.onRunnerEnd(this.runnerStat); | ||
} | ||
}); | ||
@@ -166,18 +167,17 @@ this.on('client:beforeCommand', (payload) => { | ||
} | ||
onRunnerStart() { } | ||
onBeforeCommand() { } | ||
onAfterCommand() { } | ||
onScreenshot() { } | ||
onSuiteStart() { } | ||
onHookStart() { } | ||
onHookEnd() { } | ||
onTestStart() { } | ||
onTestPass() { } | ||
onTestFail() { } | ||
onTestRetry() { } | ||
onTestSkip() { } | ||
onTestEnd() { } | ||
onSuiteEnd() { } | ||
onRunnerEnd() { } | ||
onRunnerStart(runnerStats) { } | ||
onBeforeCommand(commandArgs) { } | ||
onAfterCommand(commandArgs) { } | ||
onSuiteStart(suiteStats) { } | ||
onHookStart(hookStat) { } | ||
onHookEnd(hookStats) { } | ||
onTestStart(testStats) { } | ||
onTestPass(testStats) { } | ||
onTestFail(testStats) { } | ||
onTestRetry(testStats) { } | ||
onTestSkip(testStats) { } | ||
onTestEnd(testStats) { } | ||
onSuiteEnd(suiteStats) { } | ||
onRunnerEnd(runnerStats) { } | ||
} | ||
exports.default = WDIOReporter; |
@@ -0,12 +1,27 @@ | ||
import RunnableStats from './runnable'; | ||
export interface Hook { | ||
type?: string; | ||
title: string; | ||
parent: string; | ||
fullTitle?: string; | ||
pending?: boolean; | ||
file?: string; | ||
duration?: number; | ||
cid: string; | ||
specs?: string[]; | ||
uid?: string; | ||
errors?: Error[]; | ||
error?: Error; | ||
} | ||
export default class HookStats extends RunnableStats { | ||
constructor(runner: any); | ||
uid: any; | ||
cid: any; | ||
title: any; | ||
parent: any; | ||
errors: any; | ||
error: any; | ||
state: string | undefined; | ||
uid: string; | ||
cid: string; | ||
title: string; | ||
parent: string; | ||
errors?: Error[]; | ||
error?: Error; | ||
state?: 'failed'; | ||
constructor(runner: Hook); | ||
complete(errors?: Error[]): void; | ||
} | ||
import RunnableStats from "./runnable"; | ||
//# sourceMappingURL=hook.d.ts.map |
@@ -1,11 +0,14 @@ | ||
export default class RunnableStats { | ||
static getIdentifier(runner: any): any; | ||
constructor(type: any); | ||
type: any; | ||
import { Hook } from './hook'; | ||
import { Suite } from './suite'; | ||
import { Test } from './test'; | ||
export default abstract class RunnableStats { | ||
type: string; | ||
start: Date; | ||
end?: Date; | ||
_duration: number; | ||
constructor(type: string); | ||
complete(): void; | ||
end: Date | undefined; | ||
get duration(): number; | ||
static getIdentifier(runner: Hook | Suite | Test): string; | ||
} | ||
//# sourceMappingURL=runnable.d.ts.map |
@@ -11,3 +11,3 @@ "use strict"; | ||
this.end = new Date(); | ||
this._duration = this.end - this.start; | ||
this._duration = this.end.getTime() - this.start.getTime(); | ||
} | ||
@@ -18,3 +18,3 @@ get duration() { | ||
} | ||
return new Date() - this.start; | ||
return new Date().getTime() - this.start.getTime(); | ||
} | ||
@@ -21,0 +21,0 @@ static getIdentifier(runner) { |
@@ -0,13 +1,28 @@ | ||
/// <reference types="webdriver" /> | ||
import RunnableStats from './runnable'; | ||
import { WDIOReporterOptions } from '..'; | ||
export interface Runner { | ||
cid: string; | ||
specs: string[]; | ||
config: WDIOReporterOptions; | ||
isMultiremote: boolean; | ||
sessionId?: string; | ||
capabilities: WebDriver.DesiredCapabilities; | ||
retry?: number; | ||
failures?: number; | ||
retries?: number; | ||
} | ||
export default class RunnerStats extends RunnableStats { | ||
constructor(runner: any); | ||
cid: any; | ||
capabilities: any; | ||
cid: string; | ||
capabilities: WebDriver.DesiredCapabilities; | ||
sanitizedCapabilities: string; | ||
config: any; | ||
specs: any; | ||
sessionId: any; | ||
isMultiremote: any; | ||
retry: any; | ||
config: WDIOReporterOptions; | ||
specs: string[]; | ||
sessionId?: string; | ||
isMultiremote: boolean; | ||
retry?: number; | ||
failures?: number; | ||
retries?: number; | ||
constructor(runner: Runner); | ||
} | ||
import RunnableStats from "./runnable"; | ||
//# sourceMappingURL=runner.d.ts.map |
@@ -0,15 +1,31 @@ | ||
import HookStats from './hook'; | ||
import RunnableStats from './runnable'; | ||
import TestStats from './test'; | ||
export interface Suite { | ||
type?: string; | ||
title: string; | ||
parent?: string; | ||
fullTitle: string; | ||
pending?: boolean; | ||
fil?: string; | ||
duration?: number; | ||
cid?: string; | ||
specs?: string[]; | ||
uid?: string; | ||
tags?: string[]; | ||
description?: string; | ||
} | ||
export default class SuiteStats extends RunnableStats { | ||
constructor(suite: any); | ||
uid: any; | ||
cid: any; | ||
title: any; | ||
fullTitle: any; | ||
tags: any; | ||
tests: any[]; | ||
hooks: any[]; | ||
suites: any[]; | ||
hooksAndTests: any[]; | ||
description: any; | ||
uid: string; | ||
cid?: string; | ||
title: string; | ||
fullTitle: string; | ||
tags?: string[]; | ||
tests: TestStats[]; | ||
hooks: HookStats[]; | ||
suites: SuiteStats[]; | ||
hooksAndTests: (HookStats | TestStats)[]; | ||
description?: string; | ||
constructor(suite: Suite); | ||
} | ||
import RunnableStats from "./runnable"; | ||
//# sourceMappingURL=suite.d.ts.map |
@@ -10,2 +10,6 @@ "use strict"; | ||
super(suite.type || 'suite'); | ||
this.tests = []; | ||
this.hooks = []; | ||
this.suites = []; | ||
this.hooksAndTests = []; | ||
this.uid = runnable_1.default.getIdentifier(suite); | ||
@@ -16,6 +20,2 @@ this.cid = suite.cid; | ||
this.tags = suite.tags; | ||
this.tests = []; | ||
this.hooks = []; | ||
this.suites = []; | ||
this.hooksAndTests = []; | ||
this.description = suite.description; | ||
@@ -22,0 +22,0 @@ } |
@@ -0,19 +1,49 @@ | ||
import { pickle } from 'cucumber'; | ||
import RunnableStats from './runnable'; | ||
export interface Test { | ||
type: 'test:start' | 'test:pass' | 'test:fail' | 'test:retry' | 'test:pending' | 'test:end'; | ||
title: string; | ||
parent: string; | ||
fullTitle: string; | ||
pending: boolean; | ||
file?: string; | ||
duration?: number; | ||
cid: string; | ||
specs: string[]; | ||
uid: string; | ||
pendingReason?: string; | ||
error?: Error; | ||
errors?: Error[]; | ||
retries?: number; | ||
argument?: pickle.Argument; | ||
} | ||
interface Output { | ||
method: 'PUT' | 'POST' | 'GET' | 'DELETE'; | ||
endpoint: string; | ||
body: {}; | ||
result: { | ||
value: string | null; | ||
}; | ||
sessionId: string; | ||
cid: string; | ||
type: 'command' | 'result'; | ||
} | ||
export default class TestStats extends RunnableStats { | ||
constructor(test: any); | ||
uid: any; | ||
cid: any; | ||
title: any; | ||
fullTitle: any; | ||
output: any[]; | ||
argument: any; | ||
retries: any; | ||
state: string; | ||
uid: string; | ||
cid: string; | ||
title: string; | ||
fullTitle: string; | ||
output: Output[]; | ||
argument?: pickle.Argument; | ||
retries?: number; | ||
state: 'pending' | 'passed' | 'skipped' | 'failed'; | ||
pendingReason?: string; | ||
errors?: Error[]; | ||
error?: Error; | ||
constructor(test: Test); | ||
pass(): void; | ||
skip(reason: any): void; | ||
pendingReason: any; | ||
fail(errors: any): void; | ||
errors: any; | ||
error: any; | ||
skip(reason: string): void; | ||
fail(errors?: Error[]): void; | ||
} | ||
import RunnableStats from "./runnable"; | ||
export {}; | ||
//# sourceMappingURL=test.d.ts.map |
@@ -1,4 +0,8 @@ | ||
export function sanitizeString(str: string): string; | ||
export function sanitizeCaps(caps: Object): string; | ||
export function getErrorsFromEvent(e: any): any; | ||
/// <reference types="webdriver" /> | ||
export declare function sanitizeString(str?: string): string; | ||
export declare function sanitizeCaps(caps?: WebDriver.DesiredCapabilities): string; | ||
export declare function getErrorsFromEvent(e: { | ||
errors?: any; | ||
error?: any; | ||
}): any; | ||
//# sourceMappingURL=utils.d.ts.map |
{ | ||
"name": "@wdio/reporter", | ||
"version": "6.6.6", | ||
"version": "6.7.0", | ||
"description": "A WebdriverIO utility to help reporting all events", | ||
@@ -25,2 +25,3 @@ "author": "Christian Bromann <christian@saucelabs.com>", | ||
"devDependencies": { | ||
"@types/tmp": "^0.2.0", | ||
"tmp": "^0.2.0" | ||
@@ -32,6 +33,8 @@ }, | ||
"dependencies": { | ||
"@types/cucumber": "^6.0.1", | ||
"@types/fs-extra": "^9.0.1", | ||
"fs-extra": "^9.0.0" | ||
}, | ||
"types": "reporter.d.ts", | ||
"gitHead": "bd5a61a663dc0e0061f4d27009b4c94163cf3fd7" | ||
"gitHead": "5b130b13e3a39a6800bf38e5cc398bf3af420117" | ||
} |
@@ -11,3 +11,2 @@ declare namespace WDIOReporter { | ||
onAfterCommand(command: AfterCommand): void; | ||
onScreenshot(): void; | ||
onSuiteStart(suite: Suite): void; | ||
@@ -14,0 +13,0 @@ onHookStart(hook: Hook): void; |
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
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
39356
27
648
1
0
3
2
+ Added@types/cucumber@^6.0.1
+ Added@types/fs-extra@^9.0.1
+ Added@types/cucumber@6.0.1(transitive)
+ Added@types/fs-extra@9.0.13(transitive)
+ Added@types/node@22.13.1(transitive)
+ Addedundici-types@6.20.0(transitive)