From e79e23ddd1aaadcc5030fee07b45bcf3f7eba15e Mon Sep 17 00:00:00 2001 From: bymyself Date: Sat, 2 May 2026 13:52:16 -0700 Subject: [PATCH] test(assert): tighten DEV-throw test with console.error and reporter assertions Strengthens the existing DEV-mode throw test to also verify the full DEV failure policy: - console.error is still emitted alongside the throw - the registered reporter is NOT called in DEV (DEV throws instead of delegating) Catches regressions in the "throw in DEV, report only in non-DEV" split. Addresses review feedback: https://github.com/Comfy-Org/ComfyUI_frontend/pull/11824#discussion_r3176025478 --- src/base/assert.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/base/assert.test.ts b/src/base/assert.test.ts index be6e1475f9..7ac759392f 100644 --- a/src/base/assert.test.ts +++ b/src/base/assert.test.ts @@ -30,9 +30,15 @@ describe('assert', () => { it('throws in DEV mode when condition is false', () => { vi.stubEnv('DEV', true) + const reporter = vi.fn() + setAssertReporter(reporter) expect(() => assert(false, 'dev error')).toThrow( '[Assertion failed]: dev error' ) + expect(consoleErrorSpy).toHaveBeenCalledWith( + '[Assertion failed]: dev error' + ) + expect(reporter).not.toHaveBeenCalled() }) it('does not throw in non-DEV mode when condition is false', () => {