From 42e2a3383c88c6bac64bd9ac175b3c788c927c77 Mon Sep 17 00:00:00 2001 From: Stan Lewis Date: Mon, 28 Sep 2026 10:39:00 -0400 Subject: [PATCH] fix: adjust tests to work locally Make test assertions independent of terminal color formatting when inspecting Task.log warnings in checkHeavyDependencies tests. Assisted-By: OpenCode Signed-off-by: Stan Lewis rh-pre-commit.version: 2.4.0 rh-pre-commit.check-secrets: ENABLED --- .../check-heavy-deps.test.ts | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/src/commands/export-dynamic-plugin/check-heavy-deps.test.ts b/src/commands/export-dynamic-plugin/check-heavy-deps.test.ts index cf5cb5b..de4ad73 100644 --- a/src/commands/export-dynamic-plugin/check-heavy-deps.test.ts +++ b/src/commands/export-dynamic-plugin/check-heavy-deps.test.ts @@ -66,11 +66,13 @@ describe('checkHeavyDependencies', () => { expect(logSpy).toHaveBeenCalledTimes(2); expect(logSpy.mock.calls[0][0]).toContain( - 'WARNING: Found heavy dependency @backstage/backend-defaults', + 'WARNING: Found heavy dependency', ); + expect(logSpy.mock.calls[0][0]).toContain('@backstage/backend-defaults'); expect(logSpy.mock.calls[1][0]).toContain( - 'WARNING: Found heavy dependency @backstage/backend-app-api', + 'WARNING: Found heavy dependency', ); + expect(logSpy.mock.calls[1][0]).toContain('@backstage/backend-app-api'); expect(logSpy.mock.calls[0][0]).toContain( 'Should not be used in backend plugins', ); @@ -95,7 +97,10 @@ describe('checkHeavyDependencies', () => { ); expect(logSpy).toHaveBeenCalledTimes(1); expect(logSpy.mock.calls[0][0]).toContain( - 'WARNING: Found heavy dependency @backstage/backend-test-utils', + 'WARNING: Found heavy dependency', + ); + expect(logSpy.mock.calls[0][0]).toContain( + '@backstage/backend-test-utils', ); }); @@ -157,13 +162,18 @@ describe('checkHeavyDependencies', () => { expect(logSpy).toHaveBeenCalledTimes(3); expect(logSpy.mock.calls[0][0]).toContain( - 'WARNING: Found heavy dependency @backstage/core-app-api', + 'WARNING: Found heavy dependency', ); + expect(logSpy.mock.calls[0][0]).toContain('@backstage/core-app-api'); expect(logSpy.mock.calls[1][0]).toContain( - 'WARNING: Found heavy dependency @backstage/frontend-defaults', + 'WARNING: Found heavy dependency', + ); + expect(logSpy.mock.calls[1][0]).toContain('@backstage/frontend-defaults'); + expect(logSpy.mock.calls[2][0]).toContain( + 'WARNING: Found heavy dependency', ); expect(logSpy.mock.calls[2][0]).toContain( - 'WARNING: Found heavy dependency @backstage/frontend-test-utils', + '@backstage/frontend-test-utils', ); });