From 1f1e5c092b212768dad95fd9eeabe599ee5b2f09 Mon Sep 17 00:00:00 2001 From: Brian DeHamer Date: Wed, 18 Feb 2026 10:26:30 -0800 Subject: [PATCH] expect specific errors Signed-off-by: Brian DeHamer --- __tests__/unit/predicate.test.ts | 4 ++-- __tests__/unit/sbom.test.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/__tests__/unit/predicate.test.ts b/__tests__/unit/predicate.test.ts index 56b942d..6d08b8b 100644 --- a/__tests__/unit/predicate.test.ts +++ b/__tests__/unit/predicate.test.ts @@ -90,7 +90,7 @@ describe('predicateFromInputs', () => { predicate: 'not valid json' } - await expect(predicateFromInputs(inputs)).rejects.toThrow() + await expect(predicateFromInputs(inputs)).rejects.toThrow(/JSON/) }) }) @@ -136,7 +136,7 @@ describe('predicateFromInputs', () => { predicatePath: filePath } - await expect(predicateFromInputs(inputs)).rejects.toThrow() + await expect(predicateFromInputs(inputs)).rejects.toThrow(/JSON/) }) }) }) diff --git a/__tests__/unit/sbom.test.ts b/__tests__/unit/sbom.test.ts index 1f0e625..39613a5 100644 --- a/__tests__/unit/sbom.test.ts +++ b/__tests__/unit/sbom.test.ts @@ -38,7 +38,7 @@ describe('parseSBOMFromPath', () => { const filePath = path.join(tempDir, 'invalid.json') await fs.writeFile(filePath, 'not valid json') - await expect(parseSBOMFromPath(filePath)).rejects.toThrow() + await expect(parseSBOMFromPath(filePath)).rejects.toThrow(/JSON/) }) it('should throw when file exceeds maximum size', async () => {