-
-
Notifications
You must be signed in to change notification settings - Fork 382
Description
Describe the bug.
While reviewing the integration tests under packages/helpers/test, I noticed that multiple test suites share a single AsyncAPI Parser instance and a single parsed AsyncAPI document via beforeAll.
Examples include (but are not limited to):
bindings.test.js discriminators.test.js operations.test.js servers.test.js
Current Behavior
Parser is a stateful class.
The parsed AsyncAPI document exposes mutable collections (channels, operations, messages).
Sharing a single parser instance and parsed document across tests can introduce:
State leakage between tests
Order-dependent behavior
Fragility when tests are run in parallel or when new tests are added
There is already an explicit comment in bindings.test.js indicating that shared state must be preserved:
Expected behavior
Each test suite (or test case) should be fully isolated, meaning:
Tests should not depend on shared parser state or shared parsed documents.
Mutations or derived data in one test should not affect other tests.
Test outcomes should be deterministic regardless of execution order or parallelization.
Suggested direction
To improve isolation and long-term stability, it may be preferable to:
Instantiate a new Parser per test suite or per test, and/or
Parse the AsyncAPI document in a more isolated scope instead of sharing it globally via beforeAll.
Screenshots
How to Reproduce
Clone the repo
visit:-generator\packages\helpers\test
Analyse:-
bindings.test.js discriminators.test.js operations.test.js servers.test.js
🖥️ Device Information [optional]
Operating System :-Brave
Browser: Brave
👀 Have you checked for similar open issues?
- I checked and didn't find similar issue
🏢 Have you read the Contributing Guidelines?
- I have read the Contributing Guidelines
Are you willing to work on this issue ?
Yes I am willing to submit a PR!