Skip to content

refactor: use stderr for all output except for the output for program…#2033

Merged
andriimredocly merged 1 commit intov2from
refactor/logger
Apr 1, 2025
Merged

refactor: use stderr for all output except for the output for program…#2033
andriimredocly merged 1 commit intov2from
refactor/logger

Conversation

@andriimredocly
Copy link
Contributor

What/Why/How?

Refactor the CLI logger to use stderr for all text output except the output that the user may want to use programmatically - it is sent to stdout. Use in cli package the logger from openapi-core

Reference

Testing

Screenshots (optional)

Check yourself

  • Code changed? - Tested with redoc/reference-docs/workflows (internal)
  • All new/updated code is covered with tests
  • New package installed? - Tested in different environments (browser/node)

Security

  • Security impact of change has been considered
  • Code follows company security practices and guidelines

@changeset-bot
Copy link

changeset-bot bot commented Mar 31, 2025

⚠️ No Changeset found

Latest commit: a00aed8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

});

it('should throw an error if rules are not provided', () => {
vi.mocked(red).mockImplementation((text) => text as string);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is it for?

});

expect(process.stderr.write).toBeCalledTimes(2);
expect(vi.mocked(process.stderr.write)).toBeCalledTimes(2);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we expect mocked?

@andriimredocly andriimredocly marked this pull request as ready for review March 31, 2025 16:36
@andriimredocly andriimredocly requested a review from a team as a code owner March 31, 2025 16:36
@andriimredocly andriimredocly merged commit 3ec0d75 into v2 Apr 1, 2025
23 of 29 checks passed
@andriimredocly andriimredocly deleted the refactor/logger branch April 1, 2025 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants