diff --git a/cli/unstable_progress_bar.ts b/cli/unstable_progress_bar.ts index 3201d277f1b5..e45fa096eaba 100644 --- a/cli/unstable_progress_bar.ts +++ b/cli/unstable_progress_bar.ts @@ -24,18 +24,10 @@ export interface ProgressBarFormatter { * The duration of the progress bar. */ time: number; - /** - * The duration passed to the last call. - */ - previousTime: number; /** * The current value the progress bar is sitting at. */ value: number; - /** - * The value passed to the last call. - */ - previousValue: number; /** * The max value expected to receive. */ @@ -202,8 +194,6 @@ export class ProgressBar { #writer: WritableStreamDefaultWriter; #id: number; #startTime: number; - #lastTime: number; - #lastValue: number; #barLength: number; #fillChar: string; #emptyChar: string; @@ -250,8 +240,6 @@ export class ProgressBar { .catch(() => clearInterval(this.#id)); this.#writer = stream.writable.getWriter(); this.#startTime = performance.now(); - this.#lastTime = this.#startTime; - this.#lastValue = this.value; this.#id = setInterval(() => this.#print(), 1000); this.#print(); @@ -277,13 +265,9 @@ export class ProgressBar { }, progressBar: `${fillChars}${emptyChars}`, time: currentTime - this.#startTime, - previousTime: this.#lastTime - this.#startTime, value: this.value, - previousValue: this.#lastValue, max: this.max, }; - this.#lastTime = currentTime; - this.#lastValue = this.value; await this.#writer.write("\r\u001b[K" + this.#fmt(formatter)) .catch(() => {}); } diff --git a/cli/unstable_progress_bar_test.ts b/cli/unstable_progress_bar_test.ts index ffaf22b877c9..0977a77233c5 100644 --- a/cli/unstable_progress_bar_test.ts +++ b/cli/unstable_progress_bar_test.ts @@ -64,29 +64,6 @@ Deno.test("ProgressBar() can remove itself when finished", async () => { assertEquals(actual, expected); }); -Deno.test("ProgressBar() passes correct values to formatter", async () => { - const { readable, writable } = new TransformStream(); - let lastTime: undefined | number = undefined; - let lastValue: undefined | number = undefined; - const bar = new ProgressBar({ - writable, - max: 10 * 1000, - keepOpen: false, - fmt(x) { - if (lastTime != undefined) assertEquals(x.previousTime, lastTime); - if (lastValue != undefined) assertEquals(x.previousValue, lastValue); - lastTime = x.time; - lastValue = x.value; - return ""; - }, - }); - - for await (const a of getData(10, 1000)) bar.value += a.length; - bar.stop(); - - await new Response(readable).bytes(); -}); - Deno.test("ProgressBar() uses correct unit type", async () => { const units = ["KiB", "MiB", "GiB", "TiB", "PiB"]; let i = 0;