Skip to content

[BUG] Missing test coverage for --output=overwrite path in optimize command #1944

@mishraa-G

Description

@mishraa-G

Describe the bug.

While running npm run test --if-present, I noticed that the test coverage for
src/apps/cli/commands/optimize.ts is quite low.

Specifically, there does not seem to be any test covering the following execution path:
asyncapi optimize file.yml --output=overwrite --no-tty

This code path overwrites the original AsyncAPI file in place. Since this behavior is not currently covered by any automated test, regressions in this area could potentially go unnoticed.

Expected behavior

When the optimize command is executed with --output=overwrite --no-tty, the original AsyncAPI file should be overwritten correctly.
This behavior should be validated by an automated test to ensure future changes do not accidentally break or alter this functionality.

Screenshots

N/A

How to Reproduce

  1. Run: npm run test --if-present
  2. Check the coverage report
  3. Observe that optimize.ts has low coverage and that the --output=overwrite path is not exercised

🖥️ Device Information [optional]

  • Operating System (OS): macOS
  • Browser: N/A
  • Browser Version: N/A

👀 Have you checked for similar open issues?

  • 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    To Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions