cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] optimize command: missing test coverage for --output=overwrite

Open SanidhyaMadheshia opened this issue 11 months ago • 6 comments

Describe the bug.

Ran npm run test --if-present and noticed low test coverage in src/apps/cli/commands/optimize.ts.

Image

Specifically, there is no test covering the --output=overwrite path:

asyncapi optimize file.yml --output=overwrite --no-tty

This code path overwrites the original AsyncAPI file, so missing coverage could allow regressions to go unnoticed.

Expected behavior

The optimize command should overwrite the original AsyncAPI file when --output=overwrite --no-tty is used, and this behavior should be covered by an automated test to ensure regressions are detected.

Screenshots

Image

How to Reproduce

  1. run npm run test --if-present
  2. see the coverage

🖥️ Device Information [optional]

  • Operating System (OS):
  • Browser:
  • Browser Version:

👀 Have you checked for similar open issues?

  • [x] I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

Yes I am willing to submit a PR!

SanidhyaMadheshia avatar Dec 18 '25 19:12 SanidhyaMadheshia

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

github-actions[bot] avatar Dec 18 '25 19:12 github-actions[bot]

hey @AayushSaini101 Please have a view on this issue and let me know if I should raise a PR

SanidhyaMadheshia avatar Dec 18 '25 21:12 SanidhyaMadheshia

Hey @SanidhyaMadheshia I’m interested in working on this issue to add a test for the --output=overwrite --no-tty path in the asyncapi optimize command. I’ve read the contributing guidelines and would appreciate any guidance on how to best structure the test to ensure it safely overwrites a temporary file without affecting other tests.

timoh99 avatar Dec 19 '25 13:12 timoh99

hey @princerajpoot20 Please have a view on this issue and let me know if I should raise a PR

SanidhyaMadheshia avatar Dec 25 '25 22:12 SanidhyaMadheshia

Hey @Shurtu-gal , @AayushSaini101 , @princerajpoot20

Quick check before I start, does it make sense for me to add an integration test covering the asyncapi optimize --output=overwrite --no-tty path? The plan would be to run it on a temporary copy of a fixture and assert the file is safely overwritten and still valid.

wanted to check if I can open a PR for this?

mishraa-G avatar Dec 27 '25 14:12 mishraa-G

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart:

github-actions[bot] avatar Apr 27 '26 00:04 github-actions[bot]