Skip to content

fix: match jest json output by making json reporter output ndjson-compatible#4824

Merged
sheremet-va merged 1 commit intovitest-dev:mainfrom
bard:fix-make-json-output-ndjson-compatible
Dec 31, 2023
Merged

fix: match jest json output by making json reporter output ndjson-compatible#4824
sheremet-va merged 1 commit intovitest-dev:mainfrom
bard:fix-make-json-output-ndjson-compatible

Conversation

@bard
Copy link
Copy Markdown
Contributor

@bard bard commented Dec 29, 2023

Description

This change improves compatibility of the JSON reporter with Jest's --json output by making thhe reporter's output parsable as NDJSON.

Jest's JSON output is printed on a single line, which makes it consumable by NDJSON parsers when run in watch mode. Vitest's JSON output is pretty-printed; it can still be consumed when run in watch mode with e.g. stream-json, but that's more complex and less familiar for most. Given that this output is primarily intended for other programs, making it parsable as NDJSON makes intergrators' work easier. The occasional scenario of a human inspecting the output is covered by piping it into jq.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. If the feature is substantial or introduces breaking changes without a discussion, PR might be closed.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • If you introduce new functionality, document it. You can run documentation with pnpm run docs command.

Changesets

  • Changes in changelog are generated from PR name. Please, make sure that it explains your changes in an understandable manner. Please, prefix changeset messages with feat:, fix:, perf:, docs:, or chore:.

Loading
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