Skip to content

fix: stream and compress reporter output#9255

Closed
hi-ogawa wants to merge 8 commits intovitest-dev:mainfrom
hi-ogawa:12-15-fix_streaming_write_read_for_reporter
Closed

fix: stream and compress reporter output#9255
hi-ogawa wants to merge 8 commits intovitest-dev:mainfrom
hi-ogawa:12-15-fix_streaming_write_read_for_reporter

Conversation

@hi-ogawa
Copy link
Copy Markdown
Collaborator

@hi-ogawa hi-ogawa commented Dec 15, 2025

Description

Resolves #9216

This PR replaces flatted with turbo-stream for blob and html reporter output file format. This avoids generating a large string before writing out to a file.

// previously
import { stringify } from "flatted"
const outpuString = stringify(data);

// this PR
import { encode } from "turbo-stream"
const outputStream = encode(data)
   .pipeThrough(new TextEncoderStream())
   .pipeThrough(new CompressionStream('gzip'))

(ACTUALLY, it turned out RangeError: Invalid string length still occurs because it joins the chunks before flushing jacob-ebey/turbo-stream#77)

TODO

  • streaming output
    • gzip
  • optimize structure (this might not be effective since gzip compresses similar strings better)
  • flag to opt-out importDurations collection (in a separate PR)
  • test

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.
  • Please check Allow edits by maintainers to make review process faster. Note that this option is not available for repositories that are owned by Github organizations.

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:.

@netlify
Copy link
Copy Markdown

netlify bot commented Dec 15, 2025

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 15ba247
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/693fddb3485eb10009047cf3
😎 Deploy Preview https://deploy-preview-9255--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@hi-ogawa hi-ogawa changed the title fix: stream reporter output and optimize format fix: stream reporter output and optimize encoding Dec 15, 2025
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Dec 15, 2025

@vitest/browser

npm i https://pkg.pr.new/@vitest/browser@9255

@vitest/browser-playwright

npm i https://pkg.pr.new/@vitest/browser-playwright@9255

@vitest/browser-preview

npm i https://pkg.pr.new/@vitest/browser-preview@9255

@vitest/browser-webdriverio

npm i https://pkg.pr.new/@vitest/browser-webdriverio@9255

@vitest/coverage-istanbul

npm i https://pkg.pr.new/@vitest/coverage-istanbul@9255

@vitest/coverage-v8

npm i https://pkg.pr.new/@vitest/coverage-v8@9255

@vitest/expect

npm i https://pkg.pr.new/@vitest/expect@9255

@vitest/mocker

npm i https://pkg.pr.new/@vitest/mocker@9255

@vitest/pretty-format

npm i https://pkg.pr.new/@vitest/pretty-format@9255

@vitest/runner

npm i https://pkg.pr.new/@vitest/runner@9255

@vitest/snapshot

npm i https://pkg.pr.new/@vitest/snapshot@9255

@vitest/spy

npm i https://pkg.pr.new/@vitest/spy@9255

@vitest/ui

npm i https://pkg.pr.new/@vitest/ui@9255

@vitest/utils

npm i https://pkg.pr.new/@vitest/utils@9255

vitest

npm i https://pkg.pr.new/vitest@9255

@vitest/web-worker

npm i https://pkg.pr.new/@vitest/web-worker@9255

@vitest/ws-client

npm i https://pkg.pr.new/@vitest/ws-client@9255

commit: 15ba247

@hi-ogawa hi-ogawa changed the title fix: stream reporter output and optimize encoding fix: stream and compress reporter output Dec 15, 2025
@hi-ogawa
Copy link
Copy Markdown
Collaborator Author

hi-ogawa commented Jan 7, 2026

superseded by #9401

@hi-ogawa hi-ogawa closed this Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reporters data is bloated compared to v3.1.x

1 participant