mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-24 22:58:08 +00:00
refactor: wrap console.warn spy in try/finally for cleanup safety
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -634,29 +634,30 @@ describe('ComfyNodeDefImpl', () => {
|
||||
|
||||
it('should emit deprecation warning for optional input with defaultInput', () => {
|
||||
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {})
|
||||
try {
|
||||
new ComfyNodeDefImpl({
|
||||
name: 'TestNode',
|
||||
display_name: 'Test Node',
|
||||
category: 'Test',
|
||||
python_module: 'test_module',
|
||||
description: 'A test node',
|
||||
input: {
|
||||
optional: {
|
||||
seed: ['INT', { defaultInput: true }]
|
||||
}
|
||||
},
|
||||
output: [],
|
||||
output_is_list: [],
|
||||
output_name: [],
|
||||
output_node: false
|
||||
} as ComfyNodeDefV1)
|
||||
|
||||
new ComfyNodeDefImpl({
|
||||
name: 'TestNode',
|
||||
display_name: 'Test Node',
|
||||
category: 'Test',
|
||||
python_module: 'test_module',
|
||||
description: 'A test node',
|
||||
input: {
|
||||
optional: {
|
||||
seed: ['INT', { defaultInput: true }]
|
||||
}
|
||||
},
|
||||
output: [],
|
||||
output_is_list: [],
|
||||
output_name: [],
|
||||
output_node: false
|
||||
} as ComfyNodeDefV1)
|
||||
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
'Use of defaultInput on optional input test_module:TestNode:seed is deprecated and ignored. Remove defaultInput. Use forceInput only if you intentionally want a socket-only input.'
|
||||
)
|
||||
|
||||
warnSpy.mockRestore()
|
||||
expect(warnSpy).toHaveBeenCalledWith(
|
||||
'Use of defaultInput on optional input test_module:TestNode:seed is deprecated and ignored. Remove defaultInput. Use forceInput only if you intentionally want a socket-only input.'
|
||||
)
|
||||
} finally {
|
||||
warnSpy.mockRestore()
|
||||
}
|
||||
})
|
||||
|
||||
it('should not mutate the original node definition', () => {
|
||||
|
||||
Reference in New Issue
Block a user