Comfy-Org / Comfy-Org/ComfyUI_frontend

test: eliminate mutable describe block state

Open
#16,398 0 comments 0 reactions 1 assignee Claimed by @DrJKL View on GitHub
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Summary

Remove mutable state declared at `describe` block scope from test files.

## Rationale

Mutable `describe` block state can leak between tests and makes test setup and cleanup harder to reason about. Each test must create its own state, or use a fixture or helper that returns isolated state.

## Initial affected area

- `src/lib/litegraph/src/LGraph.test.ts`
- `describe('legacy proxyWidget warning', ...)` currently uses mutable `subgraph`, `serialized`, and `instanceData` variables at `describe` scope.

## Required changes

1. Refactor the initial affected test suite to avoid mutable `describe` block state.
2. Audit the test codebase for equivalent mutable state declared outside individual tests.
3. Replace each occurrence with isolated local setup, a fixture, or a helper that returns test-specific state.
4. Preserve existing test behavior and cleanup of LiteGraph node-type registrations.

## Acceptance criteria

- No mutable test state remains at `describe` block scope in the audited areas.
- Each test has isolated setup and teardown behavior.
- LiteGraph node-type registrations remain registered only for the required test lifetime and are unregistered after use.
- Existing affected tests pass without relying on test execution order.

## Backlinks

- Pull request: https://github.com/Comfy-Org/ComfyUI_frontend/pull/16242
- Review comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/16242#discussion_r3896277156
- Requested by: @DrJKL

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.