From 7dc54e2267243fb870d1e68122822d366e3e05b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fredrik=20Adel=C3=B6w?= Date: Fri, 6 Mar 2026 16:14:23 +0100 Subject: [PATCH] Fix crypto mock in Cache.test.ts to preserve full module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The jest.mock('crypto') was replacing the entire module, causing @smithy/uuid to fail with "Cannot read properties of undefined (reading 'bind')" when @backstage/backend-test-utils was imported. Co-Authored-By: Claude Opus 4.6 Signed-off-by: Fredrik Adelöw --- packages/repo-tools/src/commands/package-docs/Cache.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/repo-tools/src/commands/package-docs/Cache.test.ts b/packages/repo-tools/src/commands/package-docs/Cache.test.ts index d0293c09b0..02c1f5f427 100644 --- a/packages/repo-tools/src/commands/package-docs/Cache.test.ts +++ b/packages/repo-tools/src/commands/package-docs/Cache.test.ts @@ -24,11 +24,13 @@ import { readFile } from 'node:fs/promises'; import { join as joinPath } from 'node:path'; jest.mock('crypto', () => { + const actual = jest.requireActual('crypto'); const hash = { update: jest.fn(), digest: jest.fn().mockReturnValue('test'), }; return { + ...actual, createHash: jest.fn().mockReturnValue(hash), }; });