From b73c402243fd7fb689e7504d08b462cde26032b6 Mon Sep 17 00:00:00 2001 From: Patrick Taylor Date: Sun, 27 Oct 2024 21:52:03 +0000 Subject: [PATCH] =?UTF-8?q?Clear=20terminal=20when=20running=20lint=20comm?= =?UTF-8?q?and=20=F0=9F=86=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commands/lint/index.ts | 3 +++ src/utils/__tests__/terminal.spec.ts | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/commands/lint/index.ts b/src/commands/lint/index.ts index 73abc0c..cb393cf 100644 --- a/src/commands/lint/index.ts +++ b/src/commands/lint/index.ts @@ -1,6 +1,9 @@ import type { LintOptions } from '@Types/commands' +import { clearTerminal } from '@Utils/terminal' const lint = (options: LintOptions) => { + clearTerminal() + console.log('Run Lint', options) } diff --git a/src/utils/__tests__/terminal.spec.ts b/src/utils/__tests__/terminal.spec.ts index 427db89..6adeb57 100644 --- a/src/utils/__tests__/terminal.spec.ts +++ b/src/utils/__tests__/terminal.spec.ts @@ -3,11 +3,11 @@ import { clearTerminal } from '../terminal' describe('clearTerminal', () => { it('calls process.stdout.write to clear the terminal', () => { - const mockWrite = jest.spyOn(process.stdout, 'write').mockImplementation(() => true) + const stdoutSpy = jest.spyOn(process.stdout, 'write').mockImplementation(() => true) clearTerminal() - expect(mockWrite).toHaveBeenCalledWith('\x1Bc\x1B[3J\x1B[2J\x1B[H') + expect(stdoutSpy).toHaveBeenCalledWith('\x1Bc\x1B[3J\x1B[2J\x1B[H') }) })