Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove unused code from onBeforeWrite hook and remove context binding(closes testcafe-private#196) #7737

Merged
merged 3 commits into from
Jun 7, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove context binding
  • Loading branch information
Artem-Babich committed Jun 6, 2023
commit 9285f614ac53a597e04c8762383ffe3d26f5ffd4
14 changes: 1 addition & 13 deletions src/reporter/plugin-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default class ReporterPluginHost {

assignIn(this, plugin);

this._initPluginHooks(pluginHooks);
this._hooks = pluginHooks;

this[errorDecorator] = this.createErrorDecorator();
}
Expand Down Expand Up @@ -230,18 +230,6 @@ export default class ReporterPluginHost {
public async reportWarnings (/* warnings */): Promise<void> { // eslint-disable-line @typescript-eslint/no-empty-function
}

private _initPluginHooks (reporterHooks: ReporterPluginHooks | undefined): void {
if (!reporterHooks)
return;

this._hooks = Object.entries(reporterHooks).reduce((previousValue, [hookName, hook]) => {
if (hook)
previousValue[hookName as keyof ReporterPluginHooks] = hook.bind(this);

return previousValue;
}, {} as ReporterPluginHooks);
}

// NOTE: It's an optional method
public async reportData (/* testRun, ...data */): Promise<void> { // eslint-disable-line @typescript-eslint/no-empty-function
}
Expand Down