Skip to content

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

@SanidhyaMadheshia

Description

@SanidhyaMadheshia

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?

  • 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