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
This commit is contained in:
bymyself
2026-05-02 13:52:16 -07:00
parent 9a64826884
commit e79e23ddd1

View File

@@ -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', () => {