mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-13 17:26:22 +00:00
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:
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user