fix(vitest-plugin): migrate deprecated vitest 4.1 imports#75
Draft
adriencaccia wants to merge 1 commit intofeat/vite-8-supportfrom
Draft
fix(vitest-plugin): migrate deprecated vitest 4.1 imports#75adriencaccia wants to merge 1 commit intofeat/vite-8-supportfrom
adriencaccia wants to merge 1 commit intofeat/vite-8-supportfrom
Conversation
…e imports Vitest 4.1 deprecated the `vitest/runners` and `vitest/suite` subpath imports, printing console warnings on every load. Introduce a compat module that dynamically resolves imports: on vitest 4.1+ it uses the main `vitest` entry point (BenchmarkRunner, TestRunner statics), and on vitest 3.x it falls back to the old subpath imports (no warnings on either version). Also bump vitest devDependency from 4.0.18 to 4.1.1, revert vite devDependency to ^7 to keep compatibility with Node 20.5.1 (vite 8 + rolldown requires Node 20.19+), and remove the now-unnecessary rolldown devDependency and tsconfig paths workaround. Co-Authored-By: Claude <noreply@anthropic.com>
Merging this PR will degrade performance by 61.43%
Performance Changes
Comparing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrate away from deprecated
vitest/runnersandvitest/suitesubpath imports.Vitest 4.1 deprecated these subpath imports, printing
console.warnon every load:vitest/runners→ useBenchmarkRunnerfromvitestvitest/suite→ useTestRunnerstatic methods fromvitestSince the plugin still supports vitest 3.2 (which doesn't export from the main entry), a compat module (
src/compat.ts) dynamically resolves the correct import path at runtime using top-level await:vitestmain entry (no warnings)vitest/runnersandvitest/suite(no warnings on 3.x)Verified locally with
codspeed run— both simulation and walltime modes work on vitest 4.1.1 (no deprecation warnings) and vitest 3.2.4 (backwards compatible).Other changes:
^4.0.18to^4.1.1^7.0.0— vite 8 + rolldown requires Node 20.19+, dev env is 20.5.1. See chore: bump Node.js minimum to 20.19+ for vite 8 dev testing #76 for the Node.js bump.jsPluginsWithTargetto rollup options for runner bundles that needesnexttarget (top-level await)@ts-expect-errorcomments (vitest 4.1 fixed thegetBenchFntypes)../compatinstead ofvitest/suite