fix(source-interactive): Fix import path in receiver tests and rename progress bar property for clarity; update SmartlogSourceOra getter for improved backward compatibility.

This commit is contained in:
2025-05-15 20:00:38 +00:00
parent 7e2f076b35
commit 13e1582732
4 changed files with 19 additions and 10 deletions

View File

@ -259,7 +259,7 @@ export class SmartlogProgressBar {
private total: number;
private current: number = 0;
private width: number;
private complete: string;
private completeChar: string;
private incomplete: string;
private renderThrottle: number;
private clear: boolean;
@ -276,7 +276,7 @@ export class SmartlogProgressBar {
constructor(options: IProgressBarOptions) {
this.total = options.total;
this.width = options.width || 30;
this.complete = options.complete || '█';
this.completeChar = options.complete || '█';
this.incomplete = options.incomplete || '░';
this.renderThrottle = options.renderThrottle || 16;
this.clear = options.clear !== undefined ? options.clear : false;
@ -369,7 +369,7 @@ export class SmartlogProgressBar {
const incompleteLength = this.width - completeLength;
// Build the progress bar
const completePart = colors[this.color] + this.complete.repeat(completeLength) + colors.reset;
const completePart = colors[this.color] + this.completeChar.repeat(completeLength) + colors.reset;
const incompletePart = this.incomplete.repeat(incompleteLength);
const progressBar = `[${completePart}${incompletePart}]`;
@ -400,12 +400,14 @@ export class SmartlogProgressBar {
export class SmartlogSourceOra extends SmartlogSourceInteractive {
// Add a stub for the oraInstance property for backward compatibility
public get oraInstance() {
// Use public methods instead of accessing private properties
const instance = this;
return {
text: this.textContent,
start: () => this.start(),
stop: () => this.stop(),
succeed: (text?: string) => this.finishSuccess(text),
fail: (text?: string) => this.finishFail(text)
get text() { return ''; }, // We can't access private textContent directly
start: () => instance.text(''), // This starts the spinner
stop: () => instance.stop(),
succeed: (text?: string) => instance.finishSuccess(text),
fail: (text?: string) => instance.finishFail(text)
};
}