From a289f44263b3a47070e4a88fe8adda10d5703cc1 Mon Sep 17 00:00:00 2001 From: Benjamin Lu Date: Tue, 5 Aug 2025 18:04:07 -0400 Subject: [PATCH] Expect ts errors and remove litegraph test from ts exclude --- src/lib/litegraph/test/LGraphButton.test.ts | 3 +++ .../test/LGraphCanvas.titleButtons.test.ts | 15 +++++++++++++++ .../test/LGraphNode.titleButtons.test.ts | 10 ++++++++++ .../test/LinkConnector.integration.test.ts | 9 +++++++++ src/lib/litegraph/test/NodeSlot.test.ts | 5 +++++ src/lib/litegraph/test/assets/testGraphs.ts | 2 ++ .../test/subgraph/ExecutableNodeDTO.test.ts | 1 + src/lib/litegraph/test/subgraph/Subgraph.test.ts | 4 ++++ .../test/subgraph/SubgraphEdgeCases.test.ts | 2 ++ .../test/subgraph/SubgraphEvents.test.ts | 6 ++++++ .../litegraph/test/subgraph/SubgraphIO.test.ts | 10 ++++++++++ .../test/subgraph/SubgraphMemory.test.ts | 6 ++++++ .../litegraph/test/subgraph/SubgraphNode.test.ts | 2 ++ .../subgraph/SubgraphNode.titleButton.test.ts | 3 +++ .../test/subgraph/SubgraphSerialization.test.ts | 4 ++++ .../test/subgraph/SubgraphWidgetPromotion.test.ts | 9 +++++++++ .../subgraph/fixtures/advancedEventHelpers.ts | 6 ++++++ .../test/subgraph/fixtures/subgraphFixtures.ts | 9 +++++++++ .../test/subgraph/fixtures/subgraphHelpers.ts | 12 ++++++++++++ tsconfig.json | 3 --- 20 files changed, 118 insertions(+), 3 deletions(-) diff --git a/src/lib/litegraph/test/LGraphButton.test.ts b/src/lib/litegraph/test/LGraphButton.test.ts index 54d0a66278..ee67a5678d 100644 --- a/src/lib/litegraph/test/LGraphButton.test.ts +++ b/src/lib/litegraph/test/LGraphButton.test.ts @@ -6,6 +6,7 @@ import { Rectangle } from '@/lib/litegraph/src/infrastructure/Rectangle' describe('LGraphButton', () => { describe('Constructor', () => { it('should create a button with default options', () => { + // @ts-expect-error TODO: Fix after merge - LGraphButton constructor type issues const button = new LGraphButton({}) expect(button).toBeInstanceOf(LGraphButton) expect(button.name).toBeUndefined() @@ -13,6 +14,7 @@ describe('LGraphButton', () => { }) it('should create a button with custom name', () => { + // @ts-expect-error TODO: Fix after merge - LGraphButton constructor type issues const button = new LGraphButton({ name: 'test_button' }) expect(button.name).toBe('test_button') }) @@ -157,6 +159,7 @@ describe('LGraphButton', () => { const button = new LGraphButton({ text: '→', fontSize: 20, + // @ts-expect-error TODO: Fix after merge - color property not defined in type color: '#FFFFFF', backgroundColor: '#333333', xOffset: -10, diff --git a/src/lib/litegraph/test/LGraphCanvas.titleButtons.test.ts b/src/lib/litegraph/test/LGraphCanvas.titleButtons.test.ts index 2b8d4917f9..0c87a270a5 100644 --- a/src/lib/litegraph/test/LGraphCanvas.titleButtons.test.ts +++ b/src/lib/litegraph/test/LGraphCanvas.titleButtons.test.ts @@ -43,6 +43,7 @@ describe('LGraphCanvas Title Button Rendering', () => { canvasElement.getContext = vi.fn().mockReturnValue(ctx) + // @ts-expect-error TODO: Fix after merge - LGraphCanvas constructor type issues canvas = new LGraphCanvas(canvasElement, null, { skip_render: true, skip_events: true @@ -54,11 +55,15 @@ describe('LGraphCanvas Title Button Rendering', () => { // Mock required methods node.drawTitleBarBackground = vi.fn() + // @ts-expect-error Property 'drawTitleBarText' does not exist on type 'LGraphNode' node.drawTitleBarText = vi.fn() node.drawBadges = vi.fn() + // @ts-expect-error TODO: Fix after merge - drawToggles not defined in type node.drawToggles = vi.fn() + // @ts-expect-error TODO: Fix after merge - drawNodeShape not defined in type node.drawNodeShape = vi.fn() node.drawSlots = vi.fn() + // @ts-expect-error TODO: Fix after merge - drawContent not defined in type node.drawContent = vi.fn() node.drawWidgets = vi.fn() node.drawCollapsedSlots = vi.fn() @@ -67,6 +72,7 @@ describe('LGraphCanvas Title Button Rendering', () => { node.drawProgressBar = vi.fn() node._setConcreteSlots = vi.fn() node.arrange = vi.fn() + // @ts-expect-error TODO: Fix after merge - isSelectable not defined in type node.isSelectable = vi.fn().mockReturnValue(true) }) @@ -75,12 +81,14 @@ describe('LGraphCanvas Title Button Rendering', () => { const button1 = node.addTitleButton({ name: 'button1', text: 'A', + // @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions visible: true }) const button2 = node.addTitleButton({ name: 'button2', text: 'B', + // @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions visible: true }) @@ -117,6 +125,7 @@ describe('LGraphCanvas Title Button Rendering', () => { const visibleButton = node.addTitleButton({ name: 'visible', text: 'V', + // @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions visible: true }) @@ -160,6 +169,7 @@ describe('LGraphCanvas Title Button Rendering', () => { const button = node.addTitleButton({ name: `button${i}`, text: String(i), + // @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions visible: true }) button.getWidth = vi.fn().mockReturnValue(15) // All same width for simplicity @@ -184,6 +194,7 @@ describe('LGraphCanvas Title Button Rendering', () => { const button = node.addTitleButton({ name: 'test', text: 'T', + // @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions visible: true }) @@ -191,6 +202,7 @@ describe('LGraphCanvas Title Button Rendering', () => { const drawSpy = vi.spyOn(button, 'draw') // Set low quality rendering + // @ts-expect-error TODO: Fix after merge - lowQualityRenderingRequired not defined in type canvas.lowQualityRenderingRequired = true canvas.drawNode(node, ctx) @@ -205,12 +217,14 @@ describe('LGraphCanvas Title Button Rendering', () => { const smallButton = node.addTitleButton({ name: 'small', text: 'S', + // @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions visible: true }) const largeButton = node.addTitleButton({ name: 'large', text: 'LARGE', + // @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions visible: true }) @@ -240,6 +254,7 @@ describe('LGraphCanvas Title Button Rendering', () => { const button = node.addTitleButton({ name: 'test', text: 'X', + // @ts-expect-error TODO: Fix after merge - visible property not in LGraphButtonOptions visible: true }) diff --git a/src/lib/litegraph/test/LGraphNode.titleButtons.test.ts b/src/lib/litegraph/test/LGraphNode.titleButtons.test.ts index fb83b04c74..42990a3fd9 100644 --- a/src/lib/litegraph/test/LGraphNode.titleButtons.test.ts +++ b/src/lib/litegraph/test/LGraphNode.titleButtons.test.ts @@ -39,6 +39,7 @@ describe('LGraphNode Title Buttons', () => { it('should create buttons with default options', () => { const node = new LGraphNode('Test Node') + // @ts-expect-error TODO: Fix after merge - addTitleButton type issues const button = node.addTitleButton({}) expect(button).toBeInstanceOf(LGraphButton) @@ -56,6 +57,7 @@ describe('LGraphNode Title Buttons', () => { const button = node.addTitleButton({ name: 'close_button', text: 'X', + // @ts-expect-error TODO: Fix after merge - visible property not defined in type visible: true }) @@ -89,6 +91,7 @@ describe('LGraphNode Title Buttons', () => { ] // Simulate the click - onMouseDown should detect button click + // @ts-expect-error TODO: Fix after merge - onMouseDown method type issues const handled = node.onMouseDown(event, clickPosRelativeToNode, canvas) expect(handled).toBe(true) @@ -109,6 +112,7 @@ describe('LGraphNode Title Buttons', () => { const button = node.addTitleButton({ name: 'test_button', text: 'T', + // @ts-expect-error TODO: Fix after merge - visible property not defined in type visible: true }) @@ -137,6 +141,7 @@ describe('LGraphNode Title Buttons', () => { 180 - node.pos[1] // 180 - 200 = -20 ] + // @ts-expect-error TODO: Fix after merge - onMouseDown method type issues const handled = node.onMouseDown(event, clickPosRelativeToNode, canvas) expect(handled).toBe(false) @@ -151,12 +156,14 @@ describe('LGraphNode Title Buttons', () => { const button1 = node.addTitleButton({ name: 'button1', text: 'A', + // @ts-expect-error TODO: Fix after merge - visible property not defined in type visible: true }) const button2 = node.addTitleButton({ name: 'button2', text: 'B', + // @ts-expect-error TODO: Fix after merge - visible property not defined in type visible: true }) @@ -196,6 +203,7 @@ describe('LGraphNode Title Buttons', () => { titleY - node.pos[1] // 178 - 200 = -22 ] + // @ts-expect-error onMouseDown possibly undefined const handled = node.onMouseDown(event, clickPosRelativeToNode, canvas) expect(handled).toBe(true) @@ -252,6 +260,7 @@ describe('LGraphNode Title Buttons', () => { titleY - node.pos[1] // 178 - 200 = -22 ] + // @ts-expect-error onMouseDown possibly undefined const handled = node.onMouseDown(event, clickPosRelativeToNode, canvas) expect(handled).toBe(true) @@ -268,6 +277,7 @@ describe('LGraphNode Title Buttons', () => { describe('onTitleButtonClick', () => { it('should dispatch litegraph:node-title-button-clicked event', () => { const node = new LGraphNode('Test Node') + // @ts-expect-error TODO: Fix after merge - LGraphButton constructor type issues const button = new LGraphButton({ name: 'test_button' }) const canvas = { diff --git a/src/lib/litegraph/test/LinkConnector.integration.test.ts b/src/lib/litegraph/test/LinkConnector.integration.test.ts index d9b67054f2..7a88ebdeb2 100644 --- a/src/lib/litegraph/test/LinkConnector.integration.test.ts +++ b/src/lib/litegraph/test/LinkConnector.integration.test.ts @@ -333,9 +333,12 @@ describe('LinkConnector Integration', () => { } = graph.getNodeById(nodeId)! expect(input.link).toBeNull() + // @ts-expect-error toBeOneOf not in type definitions expect(output.links?.length).toBeOneOf([0, undefined]) + // @ts-expect-error toBeOneOf not in type definitions expect(input._floatingLinks?.size).toBeOneOf([0, undefined]) + // @ts-expect-error toBeOneOf not in type definitions expect(output._floatingLinks?.size).toBeOneOf([0, undefined]) } }) @@ -533,9 +536,12 @@ describe('LinkConnector Integration', () => { } = graph.getNodeById(nodeId)! expect(input.link).toBeNull() + // @ts-expect-error toBeOneOf not in type definitions expect(output.links?.length).toBeOneOf([0, undefined]) + // @ts-expect-error toBeOneOf not in type definitions expect(input._floatingLinks?.size).toBeOneOf([0, undefined]) + // @ts-expect-error toBeOneOf not in type definitions expect(output._floatingLinks?.size).toBeOneOf([0, undefined]) } }) @@ -849,9 +855,12 @@ describe('LinkConnector Integration', () => { } = graph.getNodeById(nodeId)! expect(input.link).toBeNull() + // @ts-expect-error toBeOneOf not in type definitions expect(output.links?.length).toBeOneOf([0, undefined]) + // @ts-expect-error toBeOneOf not in type definitions expect(input._floatingLinks?.size).toBeOneOf([0, undefined]) + // @ts-expect-error toBeOneOf not in type definitions expect(output._floatingLinks?.size).toBeOneOf([0, undefined]) } }) diff --git a/src/lib/litegraph/test/NodeSlot.test.ts b/src/lib/litegraph/test/NodeSlot.test.ts index 63d272d59b..c9d7343500 100644 --- a/src/lib/litegraph/test/NodeSlot.test.ts +++ b/src/lib/litegraph/test/NodeSlot.test.ts @@ -9,12 +9,14 @@ import { describe('NodeSlot', () => { describe('inputAsSerialisable', () => { it('removes _data from serialized slot', () => { + // @ts-expect-error Missing boundingRect property for test const slot: INodeOutputSlot = { _data: 'test data', name: 'test-id', type: 'STRING', links: [] } + // @ts-expect-error Argument type mismatch for test const serialized = outputAsSerialisable(slot) expect(serialized).not.toHaveProperty('_data') }) @@ -27,6 +29,7 @@ describe('NodeSlot', () => { link: null, widget: { name: 'test-widget', + // @ts-expect-error TODO: Fix after merge - type property not in IWidgetLocator type: 'combo', value: 'test-value-1', options: { @@ -40,6 +43,7 @@ describe('NodeSlot', () => { }) it('preserves pos for non-widget input slots', () => { + // @ts-expect-error TODO: Fix after merge - missing boundingRect property for test const normalSlot: INodeInputSlot = { name: 'test-id', type: 'STRING', @@ -57,6 +61,7 @@ describe('NodeSlot', () => { link: null, widget: { name: 'test-widget', + // @ts-expect-error TODO: Fix after merge - type property not in IWidgetLocator type: 'combo', value: 'test-value-1', options: { diff --git a/src/lib/litegraph/test/assets/testGraphs.ts b/src/lib/litegraph/test/assets/testGraphs.ts index ad00cb67fa..ffed09e6b5 100644 --- a/src/lib/litegraph/test/assets/testGraphs.ts +++ b/src/lib/litegraph/test/assets/testGraphs.ts @@ -20,6 +20,7 @@ export const oldSchemaGraph: ISerialisedGraph = { } ], nodes: [ + // @ts-expect-error TODO: Fix after merge - missing required properties for test { id: 1 } @@ -64,6 +65,7 @@ export const basicSerialisableGraph: SerialisableGraph = { } ], nodes: [ + // @ts-expect-error TODO: Fix after merge - missing required properties for test { id: 1, type: 'mustBeSet' diff --git a/src/lib/litegraph/test/subgraph/ExecutableNodeDTO.test.ts b/src/lib/litegraph/test/subgraph/ExecutableNodeDTO.test.ts index 5c05db4cdf..261d4e8ddd 100644 --- a/src/lib/litegraph/test/subgraph/ExecutableNodeDTO.test.ts +++ b/src/lib/litegraph/test/subgraph/ExecutableNodeDTO.test.ts @@ -84,6 +84,7 @@ describe('ExecutableNodeDTO Creation', () => { // Test that wrapper calls original method const args = ['arg1', 'arg2'] + // @ts-expect-error TODO: Fix after merge - applyToGraph expects different arguments dto.applyToGraph!(args[0], args[1]) expect(mockApplyToGraph).toHaveBeenCalledWith(args[0], args[1]) diff --git a/src/lib/litegraph/test/subgraph/Subgraph.test.ts b/src/lib/litegraph/test/subgraph/Subgraph.test.ts index e51fda63a2..56bd9c1008 100644 --- a/src/lib/litegraph/test/subgraph/Subgraph.test.ts +++ b/src/lib/litegraph/test/subgraph/Subgraph.test.ts @@ -181,9 +181,13 @@ describe('Subgraph Serialization', () => { expect(serialized.inputs).toHaveLength(1) expect(serialized.outputs).toHaveLength(1) + // @ts-expect-error TODO: Fix after merge - serialized.inputs possibly undefined expect(serialized.inputs[0].name).toBe('input') + // @ts-expect-error TODO: Fix after merge - serialized.inputs possibly undefined expect(serialized.inputs[0].type).toBe('number') + // @ts-expect-error TODO: Fix after merge - serialized.outputs possibly undefined expect(serialized.outputs[0].name).toBe('output') + // @ts-expect-error TODO: Fix after merge - serialized.outputs possibly undefined expect(serialized.outputs[0].type).toBe('number') } ) diff --git a/src/lib/litegraph/test/subgraph/SubgraphEdgeCases.test.ts b/src/lib/litegraph/test/subgraph/SubgraphEdgeCases.test.ts index c4b86cee42..7c3d5c778a 100644 --- a/src/lib/litegraph/test/subgraph/SubgraphEdgeCases.test.ts +++ b/src/lib/litegraph/test/subgraph/SubgraphEdgeCases.test.ts @@ -349,6 +349,7 @@ describe('SubgraphEdgeCases - Performance and Scale', () => { const subgraphNode = createTestSubgraphNode(subgraph) // Simulate concurrent operations + // @ts-expect-error TODO: Fix after merge - operations implicitly has any[] type const operations = [] for (let i = 0; i < 20; i++) { operations.push( @@ -369,6 +370,7 @@ describe('SubgraphEdgeCases - Performance and Scale', () => { // Execute all operations - should not crash expect(() => { + // @ts-expect-error TODO: Fix after merge - operations implicitly has any[] type for (const op of operations) op() }).not.toThrow() }) diff --git a/src/lib/litegraph/test/subgraph/SubgraphEvents.test.ts b/src/lib/litegraph/test/subgraph/SubgraphEvents.test.ts index 46f50e2b0f..ee6ef04fa1 100644 --- a/src/lib/litegraph/test/subgraph/SubgraphEvents.test.ts +++ b/src/lib/litegraph/test/subgraph/SubgraphEvents.test.ts @@ -21,6 +21,7 @@ describe('SubgraphEvents - Event Payload Verification', () => { }) }) + // @ts-expect-error TODO: Fix after merge - detail is of type unknown expect(addedEvents[0].detail.input).toBe(input) } ) @@ -42,6 +43,7 @@ describe('SubgraphEvents - Event Payload Verification', () => { }) }) + // @ts-expect-error TODO: Fix after merge - detail is of type unknown expect(addedEvents[0].detail.output).toBe(output) } ) @@ -68,6 +70,7 @@ describe('SubgraphEvents - Event Payload Verification', () => { index: 0 }) + // @ts-expect-error TODO: Fix after merge - detail is of type unknown expect(removingEvents[0].detail.input).toBe(input) } ) @@ -94,6 +97,7 @@ describe('SubgraphEvents - Event Payload Verification', () => { index: 0 }) + // @ts-expect-error TODO: Fix after merge - detail is of type unknown expect(removingEvents[0].detail.output).toBe(output) } ) @@ -121,6 +125,7 @@ describe('SubgraphEvents - Event Payload Verification', () => { newName: 'new_name' }) + // @ts-expect-error TODO: Fix after merge - detail is of type unknown expect(renamingEvents[0].detail.input).toBe(input) // Verify the label was updated after the event (renameInput sets label, not name) @@ -154,6 +159,7 @@ describe('SubgraphEvents - Event Payload Verification', () => { newName: 'new_name' }) + // @ts-expect-error TODO: Fix after merge - detail is of type unknown expect(renamingEvents[0].detail.output).toBe(output) // Verify the label was updated after the event diff --git a/src/lib/litegraph/test/subgraph/SubgraphIO.test.ts b/src/lib/litegraph/test/subgraph/SubgraphIO.test.ts index 93332355b3..3a93e50475 100644 --- a/src/lib/litegraph/test/subgraph/SubgraphIO.test.ts +++ b/src/lib/litegraph/test/subgraph/SubgraphIO.test.ts @@ -25,6 +25,7 @@ describe('SubgraphIO - Input Slot Dual-Nature Behavior', () => { }).not.toThrow() expect( + // @ts-expect-error TODO: Fix after merge - link can be null externalNode.outputs[0].links?.includes(subgraphNode.inputs[0].link) ).toBe(true) expect(subgraphNode.inputs[0].link).not.toBe(null) @@ -44,7 +45,9 @@ describe('SubgraphIO - Input Slot Dual-Nature Behavior', () => { // The empty slot should be configurable const emptyInput = simpleSubgraph.inputs.at(-1) + // @ts-expect-error TODO: Fix after merge - emptyInput possibly undefined expect(emptyInput.name).toBe('') + // @ts-expect-error TODO: Fix after merge - emptyInput possibly undefined expect(emptyInput.type).toBe('*') } ) @@ -118,6 +121,7 @@ describe('SubgraphIO - Output Slot Dual-Nature Behavior', () => { }).not.toThrow() expect( + // @ts-expect-error TODO: Fix after merge - link can be null subgraphNode.outputs[0].links?.includes(externalNode.inputs[0].link) ).toBe(true) expect(externalNode.inputs[0].link).not.toBe(null) @@ -137,7 +141,9 @@ describe('SubgraphIO - Output Slot Dual-Nature Behavior', () => { // The empty slot should be configurable const emptyOutput = simpleSubgraph.outputs.at(-1) + // @ts-expect-error TODO: Fix after merge - emptyOutput possibly undefined expect(emptyOutput.name).toBe('') + // @ts-expect-error TODO: Fix after merge - emptyOutput possibly undefined expect(emptyOutput.type).toBe('*') } ) @@ -422,9 +428,13 @@ describe('SubgraphIO - Empty Slot Connection', () => { expect(internalNode.inputs[0].link).not.toBe(null) const link = subgraph.links.get(internalNode.inputs[0].link!) expect(link).toBeDefined() + // @ts-expect-error TODO: Fix after merge - link possibly undefined expect(link.target_id).toBe(internalNode.id) + // @ts-expect-error TODO: Fix after merge - link possibly undefined expect(link.target_slot).toBe(0) + // @ts-expect-error TODO: Fix after merge - link possibly undefined expect(link.origin_id).toBe(subgraph.inputNode.id) + // @ts-expect-error TODO: Fix after merge - link possibly undefined expect(link.origin_slot).toBe(1) // Should be the second slot } ) diff --git a/src/lib/litegraph/test/subgraph/SubgraphMemory.test.ts b/src/lib/litegraph/test/subgraph/SubgraphMemory.test.ts index 3f4e077f78..8462a10249 100644 --- a/src/lib/litegraph/test/subgraph/SubgraphMemory.test.ts +++ b/src/lib/litegraph/test/subgraph/SubgraphMemory.test.ts @@ -71,6 +71,7 @@ describe('SubgraphNode Memory Management', () => { size: [200, 100], inputs: [], outputs: [], + // @ts-expect-error TODO: Fix after merge - properties not in ExportedSubgraphInstance properties: {}, flags: {}, mode: 0 @@ -108,8 +109,10 @@ describe('SubgraphNode Memory Management', () => { } // Simulate widget promotion + // @ts-expect-error TODO: Fix after merge - mockWidget type mismatch input._widget = mockWidget input.widget = { name: 'promoted_widget' } + // @ts-expect-error TODO: Fix after merge - mockWidget type mismatch subgraphNode.widgets.push(mockWidget) expect(input._widget).toBe(mockWidget) @@ -117,6 +120,7 @@ describe('SubgraphNode Memory Management', () => { expect(subgraphNode.widgets).toContain(mockWidget) // Remove widget (this should clean up references) + // @ts-expect-error TODO: Fix after merge - mockWidget type mismatch subgraphNode.removeWidget(mockWidget) // Widget should be removed from array @@ -141,6 +145,7 @@ describe('SubgraphNode Memory Management', () => { size: [200, 100], inputs: [], outputs: [], + // @ts-expect-error TODO: Fix after merge - properties not in ExportedSubgraphInstance properties: {}, flags: {}, mode: 0 @@ -327,6 +332,7 @@ describe('SubgraphMemory - Widget Reference Management', () => { const widget2 = { type: 'string', value: 'test', name: 'widget2' } if (subgraphNode.widgets) { + // @ts-expect-error TODO: Fix after merge - widget type mismatch subgraphNode.widgets.push(widget1, widget2) expect(subgraphNode.widgets.length).toBe(initialWidgetCount + 2) } diff --git a/src/lib/litegraph/test/subgraph/SubgraphNode.test.ts b/src/lib/litegraph/test/subgraph/SubgraphNode.test.ts index 1e4ffdf877..5003d2b183 100644 --- a/src/lib/litegraph/test/subgraph/SubgraphNode.test.ts +++ b/src/lib/litegraph/test/subgraph/SubgraphNode.test.ts @@ -209,6 +209,7 @@ describe('SubgraphNode Lifecycle', () => { size: [180, 100], inputs: [], outputs: [], + // @ts-expect-error TODO: Fix after merge - properties not in ExportedSubgraphInstance properties: {}, flags: {}, mode: 0 @@ -541,6 +542,7 @@ describe('SubgraphNode Cleanup', () => { const subgraph = createTestSubgraph() // Add and remove nodes multiple times + // @ts-expect-error TODO: Fix after merge - SubgraphNode should be Subgraph const removedNodes: SubgraphNode[] = [] for (let i = 0; i < 3; i++) { const node = createTestSubgraphNode(subgraph) diff --git a/src/lib/litegraph/test/subgraph/SubgraphNode.titleButton.test.ts b/src/lib/litegraph/test/subgraph/SubgraphNode.titleButton.test.ts index 94355cb72f..51ef2f5bde 100644 --- a/src/lib/litegraph/test/subgraph/SubgraphNode.titleButton.test.ts +++ b/src/lib/litegraph/test/subgraph/SubgraphNode.titleButton.test.ts @@ -135,6 +135,7 @@ describe('SubgraphNode Title Button', () => { 80 - subgraphNode.pos[1] // 80 - 100 = -20 ] + // @ts-expect-error onMouseDown possibly undefined const handled = subgraphNode.onMouseDown( event, clickPosRelativeToNode, @@ -171,6 +172,7 @@ describe('SubgraphNode Title Button', () => { 150 - subgraphNode.pos[1] // 150 - 100 = 50 ] + // @ts-expect-error onMouseDown possibly undefined const handled = subgraphNode.onMouseDown( event, clickPosRelativeToNode, @@ -217,6 +219,7 @@ describe('SubgraphNode Title Button', () => { 80 - subgraphNode.pos[1] // -20 ] + // @ts-expect-error onMouseDown possibly undefined const handled = subgraphNode.onMouseDown( event, clickPosRelativeToNode, diff --git a/src/lib/litegraph/test/subgraph/SubgraphSerialization.test.ts b/src/lib/litegraph/test/subgraph/SubgraphSerialization.test.ts index 79844b8806..e308935604 100644 --- a/src/lib/litegraph/test/subgraph/SubgraphSerialization.test.ts +++ b/src/lib/litegraph/test/subgraph/SubgraphSerialization.test.ts @@ -75,6 +75,7 @@ describe('SubgraphSerialization - Basic Serialization', () => { // Verify core properties expect(restored.id).toBe(original.id) expect(restored.name).toBe(original.name) + // @ts-expect-error description property not in type definition expect(restored.description).toBe(original.description) // Verify I/O structure @@ -250,6 +251,7 @@ describe('SubgraphSerialization - Version Compatibility', () => { } expect(() => { + // @ts-expect-error Type mismatch in ExportedSubgraph format const subgraph = new Subgraph(new LGraph(), modernFormat) expect(subgraph.name).toBe('Modern Subgraph') expect(subgraph.inputs.length).toBe(1) @@ -279,6 +281,7 @@ describe('SubgraphSerialization - Version Compatibility', () => { } expect(() => { + // @ts-expect-error Type mismatch in ExportedSubgraph format const subgraph = new Subgraph(new LGraph(), incompleteFormat) expect(subgraph.name).toBe('Incomplete Subgraph') // Should have default empty arrays @@ -313,6 +316,7 @@ describe('SubgraphSerialization - Version Compatibility', () => { // Should handle future format gracefully expect(() => { + // @ts-expect-error Type mismatch in ExportedSubgraph format const subgraph = new Subgraph(new LGraph(), futureFormat) expect(subgraph.name).toBe('Future Subgraph') }).not.toThrow() diff --git a/src/lib/litegraph/test/subgraph/SubgraphWidgetPromotion.test.ts b/src/lib/litegraph/test/subgraph/SubgraphWidgetPromotion.test.ts index 20e3a4dbee..05421f6165 100644 --- a/src/lib/litegraph/test/subgraph/SubgraphWidgetPromotion.test.ts +++ b/src/lib/litegraph/test/subgraph/SubgraphWidgetPromotion.test.ts @@ -23,6 +23,7 @@ function createNodeWithWidget( const input = node.addInput('value', slotType) node.addOutput('out', slotType) + // @ts-expect-error Abstract class instantiation const widget = new BaseWidget({ name: 'widget', type: widgetType, @@ -130,7 +131,9 @@ describe('SubgraphWidgetPromotion', () => { // Check event was fired const promotedEvents = eventCapture.getEventsByType('widget-promoted') expect(promotedEvents).toHaveLength(1) + // @ts-expect-error Object is of type 'unknown' expect(promotedEvents[0].detail.widget).toBeDefined() + // @ts-expect-error Object is of type 'unknown' expect(promotedEvents[0].detail.subgraphNode).toBe(subgraphNode) eventCapture.cleanup() @@ -155,7 +158,9 @@ describe('SubgraphWidgetPromotion', () => { // Check event was fired const demotedEvents = eventCapture.getEventsByType('widget-demoted') expect(demotedEvents).toHaveLength(1) + // @ts-expect-error Object is of type 'unknown' expect(demotedEvents[0].detail.widget).toBeDefined() + // @ts-expect-error Object is of type 'unknown' expect(demotedEvents[0].detail.subgraphNode).toBe(subgraphNode) // Widget should be removed @@ -177,6 +182,7 @@ describe('SubgraphWidgetPromotion', () => { const numInput = multiWidgetNode.addInput('num', 'number') const strInput = multiWidgetNode.addInput('str', 'string') + // @ts-expect-error Abstract class instantiation const widget1 = new BaseWidget({ name: 'widget1', type: 'number', @@ -186,6 +192,7 @@ describe('SubgraphWidgetPromotion', () => { node: multiWidgetNode }) + // @ts-expect-error Abstract class instantiation const widget2 = new BaseWidget({ name: 'widget2', type: 'string', @@ -325,6 +332,7 @@ describe('SubgraphWidgetPromotion', () => { const numInput = multiWidgetNode.addInput('num', 'number') const strInput = multiWidgetNode.addInput('str', 'string') + // @ts-expect-error Abstract class instantiation const widget1 = new BaseWidget({ name: 'widget1', type: 'number', @@ -335,6 +343,7 @@ describe('SubgraphWidgetPromotion', () => { tooltip: 'Number widget tooltip' }) + // @ts-expect-error Abstract class instantiation const widget2 = new BaseWidget({ name: 'widget2', type: 'string', diff --git a/src/lib/litegraph/test/subgraph/fixtures/advancedEventHelpers.ts b/src/lib/litegraph/test/subgraph/fixtures/advancedEventHelpers.ts index 0c21b9ecbe..a544c392d4 100644 --- a/src/lib/litegraph/test/subgraph/fixtures/advancedEventHelpers.ts +++ b/src/lib/litegraph/test/subgraph/fixtures/advancedEventHelpers.ts @@ -162,6 +162,7 @@ export interface MemoryLeakTestOptions { * Useful for testing that event listeners and references are properly cleaned up */ export function createMemoryLeakTest( + // @ts-expect-error TODO: Fix after merge - T does not satisfy constraint 'object' setupFn: () => { ref: WeakRef; cleanup: () => void }, options: MemoryLeakTestOptions = {} ) { @@ -173,10 +174,12 @@ export function createMemoryLeakTest( } = options return async () => { + // @ts-expect-error Type 'T' does not satisfy the constraint 'object' const refs: WeakRef[] = [] const initialMemory = process.memoryUsage?.()?.heapUsed || 0 for (let cycle = 0; cycle < cycles; cycle++) { + // @ts-expect-error Type 'T' does not satisfy the constraint 'object' const cycleRefs: WeakRef[] = [] for (let instance = 0; instance < instancesPerCycle; instance++) { @@ -268,13 +271,16 @@ export function createEventPerformanceMonitor() { }, assertPerformance: (operation: string, maxDuration: number) => { + // @ts-expect-error 'this' implicitly has type 'any' const measurements = this.getMeasurements() const relevantMeasurements = measurements.filter( + // @ts-expect-error Parameter 'm' implicitly has an 'any' type (m) => m.operation === operation ) if (relevantMeasurements.length === 0) return const avgDuration = + // @ts-expect-error Parameter 'sum' and 'm' implicitly have 'any' type relevantMeasurements.reduce((sum, m) => sum + m.duration, 0) / relevantMeasurements.length expect(avgDuration).toBeLessThan(maxDuration) diff --git a/src/lib/litegraph/test/subgraph/fixtures/subgraphFixtures.ts b/src/lib/litegraph/test/subgraph/fixtures/subgraphFixtures.ts index 377a08a76e..be49c9ffff 100644 --- a/src/lib/litegraph/test/subgraph/fixtures/subgraphFixtures.ts +++ b/src/lib/litegraph/test/subgraph/fixtures/subgraphFixtures.ts @@ -57,6 +57,7 @@ export interface SubgraphFixtures { * ``` */ export const subgraphTest = test.extend({ + // @ts-expect-error TODO: Fix after merge - fixture use parameter type emptySubgraph: async ({}, use: (value: unknown) => Promise) => { const subgraph = createTestSubgraph({ name: 'Empty Test Subgraph', @@ -68,6 +69,7 @@ export const subgraphTest = test.extend({ await use(subgraph) }, + // @ts-expect-error TODO: Fix after merge - fixture use parameter type simpleSubgraph: async ({}, use: (value: unknown) => Promise) => { const subgraph = createTestSubgraph({ name: 'Simple Test Subgraph', @@ -79,6 +81,7 @@ export const subgraphTest = test.extend({ await use(subgraph) }, + // @ts-expect-error TODO: Fix after merge - fixture use parameter type complexSubgraph: async ({}, use: (value: unknown) => Promise) => { const subgraph = createTestSubgraph({ name: 'Complex Test Subgraph', @@ -97,6 +100,7 @@ export const subgraphTest = test.extend({ await use(subgraph) }, + // @ts-expect-error TODO: Fix after merge - fixture use parameter type nestedSubgraph: async ({}, use: (value: unknown) => Promise) => { const nested = createNestedSubgraphs({ depth: 3, @@ -108,6 +112,7 @@ export const subgraphTest = test.extend({ await use(nested) }, + // @ts-expect-error TODO: Fix after merge - fixture use parameter type subgraphWithNode: async ({}, use: (value: unknown) => Promise) => { // Create the subgraph definition const subgraph = createTestSubgraph({ @@ -134,6 +139,7 @@ export const subgraphTest = test.extend({ }) }, + // @ts-expect-error TODO: Fix after merge - fixture use parameter type eventCapture: async ({}, use: (value: unknown) => Promise) => { const subgraph = createTestSubgraph({ name: 'Event Test Subgraph' @@ -184,6 +190,7 @@ export interface EdgeCaseFixtures { * These tests may intentionally create invalid states. */ export const edgeCaseTest = subgraphTest.extend({ + // @ts-expect-error TODO: Fix after merge - fixture use parameter type circularSubgraph: async ({}, use: (value: unknown) => Promise) => { const rootGraph = new LGraph() @@ -217,6 +224,7 @@ export const edgeCaseTest = subgraphTest.extend({ }) }, + // @ts-expect-error TODO: Fix after merge - fixture use parameter type deeplyNestedSubgraph: async ({}, use: (value: unknown) => Promise) => { // Create a very deep nesting structure (but not exceeding MAX_NESTED_SUBGRAPHS) const nested = createNestedSubgraphs({ @@ -229,6 +237,7 @@ export const edgeCaseTest = subgraphTest.extend({ await use(nested) }, + // @ts-expect-error TODO: Fix after merge - fixture use parameter type maxIOSubgraph: async ({}, use: (value: unknown) => Promise) => { // Create a subgraph with many inputs and outputs const inputs = Array.from({ length: 20 }, (_, i) => ({ diff --git a/src/lib/litegraph/test/subgraph/fixtures/subgraphHelpers.ts b/src/lib/litegraph/test/subgraph/fixtures/subgraphHelpers.ts index 41de11e075..fcf25ce7cb 100644 --- a/src/lib/litegraph/test/subgraph/fixtures/subgraphHelpers.ts +++ b/src/lib/litegraph/test/subgraph/fixtures/subgraphHelpers.ts @@ -96,6 +96,7 @@ export function createTestSubgraph( // Basic graph properties version: 1, nodes: [], + // @ts-expect-error TODO: Fix after merge - links type mismatch links: {}, groups: [], config: {}, @@ -129,6 +130,7 @@ export function createTestSubgraph( // Add requested inputs if (options.inputs) { for (const input of options.inputs) { + // @ts-expect-error TODO: Fix after merge - addInput parameter types subgraph.addInput(input.name, input.type) } } else if (options.inputCount) { @@ -140,6 +142,7 @@ export function createTestSubgraph( // Add requested outputs if (options.outputs) { for (const output of options.outputs) { + // @ts-expect-error TODO: Fix after merge - addOutput parameter types subgraph.addOutput(output.name, output.type) } } else if (options.outputCount) { @@ -190,6 +193,7 @@ export function createTestSubgraphNode( size: options.size || [200, 100], inputs: [], outputs: [], + // @ts-expect-error TODO: Fix after merge - properties type mismatch properties: {}, flags: {}, mode: 0 @@ -241,6 +245,7 @@ export function createNestedSubgraphs(options: NestedSubgraphOptions = {}) { if (currentParent instanceof LGraph) { currentParent.add(subgraphNode) } else { + // @ts-expect-error TODO: Fix after merge - add method parameter types currentParent.add(subgraphNode) } @@ -349,6 +354,7 @@ export function createTestSubgraphData( return { version: 1, nodes: [], + // @ts-expect-error TODO: Fix after merge - links type mismatch links: {}, groups: [], config: {}, @@ -427,14 +433,20 @@ export function createComplexSubgraphData( } return createTestSubgraphData({ + // @ts-expect-error TODO: Fix after merge - nodes parameter type nodes, + // @ts-expect-error TODO: Fix after merge - links parameter type links, inputs: [ + // @ts-expect-error TODO: Fix after merge - input object type { name: 'input1', type: 'number', pos: [0, 0] }, + // @ts-expect-error TODO: Fix after merge - input object type { name: 'input2', type: 'string', pos: [0, 1] } ], outputs: [ + // @ts-expect-error TODO: Fix after merge - output object type { name: 'output1', type: 'number', pos: [0, 0] }, + // @ts-expect-error TODO: Fix after merge - output object type { name: 'output2', type: 'string', pos: [0, 1] } ] }) diff --git a/tsconfig.json b/tsconfig.json index 43fca87248..a44da08914 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -38,8 +38,5 @@ "tests-ui/**/*", "global.d.ts", "vite.config.mts" - ], - "exclude": [ - "src/lib/litegraph/test/**/*" ] }