playwright-bdd
Version:
BDD Testing with Playwright runner
44 lines • 2.04 kB
TypeScript
/**
* Playwright reporter that generates different Cucumber reports.
*
* If there are multiple Cucumber reporters, they all generate the same Playwright messages,
* targeting messagesBuilder. The messagesBuilder performs heavy operations (like reading feature files),
* so we should build Cucumber messages only once. To achieve that, we keep track
* of the reporters count in teh reporters-registry and send Playwright events only from the first reporter.
* In onEnd, all reporters wait for messages to get built and emit them to the Cucumber reporter implementation.
*/
import { FullConfig, FullResult, Reporter as PlaywrightReporter, TestCase, TestError, TestResult } from '@playwright/test/reporter';
import MessageReporter from './message';
import HtmlReporter from './html';
import JunitReporter from './junit';
import JsonReporter from './json';
import { CustomReporterOptions } from './custom';
declare const builtinReporters: {
readonly html: typeof HtmlReporter;
readonly message: typeof MessageReporter;
readonly junit: typeof JunitReporter;
readonly 'junit-modern': typeof JunitReporter;
readonly json: typeof JsonReporter;
};
export type BuiltinReporters = typeof builtinReporters;
export type CucumberReporterOptions<T> = T extends keyof BuiltinReporters ? ConstructorParameters<BuiltinReporters[T]>[1] : CustomReporterOptions;
export default class CucumberReporterAdapter<T extends keyof BuiltinReporters | string> implements PlaywrightReporter {
private type;
private userOptions;
private reporter;
private isFirstReporter;
constructor(fullOptions: {
$type: T;
} & CucumberReporterOptions<T>);
onBegin(config: FullConfig): void;
printsToStdio(): boolean;
onTestEnd(test: TestCase, result: TestResult): void;
/**
* Error not related to any test, e.g. worker teardown.
*/
onError(error: TestError): void;
onEnd(result: FullResult): Promise<void>;
private createCucumberReporter;
}
export {};
//# sourceMappingURL=index.d.ts.map