Skip to content

Conversation

@hi-ogawa
Copy link
Contributor

@hi-ogawa hi-ogawa commented Jan 27, 2026

Description

Part of #9141

I was exploring a good option style and here I chose print: boolean | "on-warn", which is somewhat inspired by Playwright (e.g. then have use: { trace: 'on-first-retry', screenshot: 'only-on-failure' }).

Not sure if we can unify failOnDanger: boolean though. Still exploring.

Summary

  • Add print: 'on-warn' option to only show import breakdown when imports exceed warn threshold
  • Add thresholds: { warn, danger } options to configure duration thresholds (default: 100ms, 500ms)
  • Update reporter to use configurable thresholds instead of hardcoded values
  • Update UI to read thresholds from config

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

…s for importDurations

- Add `print: 'on-warn'` option to only show import breakdown when imports exceed warn threshold
- Add `thresholds: { warn, danger }` options to configure duration thresholds (default: 100ms, 500ms)
- Update reporter to use configurable thresholds instead of hardcoded values
- Update UI to read thresholds from config

Part of vitest-dev#9141

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@netlify
Copy link

netlify bot commented Jan 27, 2026

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 1d15007
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6978748da265db0008b9b8df
😎 Deploy Preview https://deploy-preview-9533--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 feat(experimental): add print: 'on-warn' and importDurtaions.thresholds feat(experimental): add print and fail thresholds Jan 27, 2026
hi-ogawa and others added 2 commits January 27, 2026 17:48
- Add `failOnDanger: boolean` option to fail the test run when imports exceed danger threshold
- When failing, breakdown is always printed regardless of `print` setting
- Sets `process.exitCode = 1` following the same pattern as coverage thresholds

Part of vitest-dev#9141

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@hi-ogawa hi-ogawa added this to the 4.1.0 milestone Jan 27, 2026
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.

1 participant