Skip to content

Commit b0e7225

Browse files
committed
docs: move LiteGraph test guidance into docs
Move the litegraph-specific CodeRabbit review rules into docs/testing/litegraph-testing.md, link the guide from docs/testing/README.md, and keep .coderabbit.yaml as a path-to-docs bridge. Verification: parsed .coderabbit.yaml with Ruby YAML and ran git diff --check.
1 parent 2e0d961 commit b0e7225

3 files changed

Lines changed: 20 additions & 7 deletions

File tree

.coderabbit.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,7 @@ reviews:
7070
Treat `.agents/checks/test-quality.md`, `docs/testing/README.md`, and `docs/guidance/vitest.md` as required review context for every changed Vitest test file.
7171
- path: 'src/lib/litegraph/**/*.test.ts'
7272
instructions: |
73-
Treat `.agents/checks/test-quality.md`, `docs/testing/README.md`, and `docs/guidance/vitest.md` as required review context for every changed litegraph Vitest test file.
74-
Reuse shared factories in `src/utils/__tests__/litegraphTestUtils.ts` instead of hand-rolling litegraph node, canvas, graph, subgraph, or workflow builders.
75-
Flag mocked litegraph classes when a real instance or shared factory would exercise behavior directly.
76-
When a PR changes litegraph graph deserialization, link loading, nullable serialized links, or sparse legacy link handling, require direct regression coverage for the changed runtime path. Helper-only coverage in a different utility is insufficient.
77-
For `LGraph.configure()` sparse legacy links, expect a test that constructs an `LGraph`, calls `configure()` with a v0.4 payload containing `links: [null, validLink]`, asserts it does not throw, and asserts the valid link is still created.
78-
For link-retargeting or widget-slot compression changes such as `compressWidgetInputSlots()`, expect a direct test of the compression path with `links: [null, validLink]` that proves the valid link is still retargeted while the null entry is ignored.
73+
Treat `.agents/checks/test-quality.md`, `docs/testing/README.md`, `docs/guidance/vitest.md`, and `docs/testing/litegraph-testing.md` as required review context for every changed litegraph Vitest test file.
7974
- path: '{browser_tests,apps/website/e2e}/**/*.spec.ts'
8075
instructions: |
8176
Treat `.agents/checks/test-quality.md`, `docs/testing/README.md`, and `docs/guidance/playwright.md` as required review context for every changed Playwright test file.

docs/testing/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ This guide provides an overview of testing approaches used in the ComfyUI Fronte
44

55
## Testing Documentation
66

7-
Documentation for unit tests is organized into three guides:
7+
Documentation for unit tests is organized into four guides:
88

99
- [Component Testing](./component-testing.md) - How to test Vue components
1010
- [Unit Testing](./unit-testing.md) - How to test utility functions, composables, and other non-component code
1111
- [Store Testing](./store-testing.md) - How to test Pinia stores specifically
12+
- [LiteGraph Testing](./litegraph-testing.md) - How to test LiteGraph graph, node, link, and workflow behavior
1213

1314
## Testing Structure
1415

docs/testing/litegraph-testing.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# LiteGraph Testing Guide
2+
3+
This guide covers test patterns for LiteGraph graph, node, link, subgraph, and workflow behavior in ComfyUI Frontend.
4+
5+
## Shared Factories
6+
7+
Reuse shared factories in `src/utils/__tests__/litegraphTestUtils.ts` instead of hand-rolling LiteGraph node, canvas, graph, subgraph, or workflow builders.
8+
9+
Use real LiteGraph instances or shared factories when they exercise behavior directly. Avoid mocking LiteGraph classes unless the test is intentionally checking a seam outside LiteGraph itself.
10+
11+
## Runtime Path Coverage
12+
13+
When a PR changes LiteGraph graph deserialization, link loading, nullable serialized links, or sparse legacy link handling, add direct regression coverage for the changed runtime path. Helper-only coverage in a different utility is not enough when the changed branch is reached through the runtime path.
14+
15+
For `LGraph.configure()` sparse legacy links, construct an `LGraph`, call `configure()` with a v0.4 payload containing `links: [null, validLink]`, assert that it does not throw, and assert that the valid link is still created.
16+
17+
For link retargeting or widget-slot compression changes such as `compressWidgetInputSlots()`, test the compression path directly with `links: [null, validLink]`. The test should prove that the valid link is still retargeted while the null entry is ignored.

0 commit comments

Comments
 (0)