Skip to content

Deprecation warnings with Vitest 4.1+ in vitest-plugin v5.2.0 #199

@hckhanh

Description

@hckhanh

Description

@codspeed/vitest-plugin@5.2.0 emits deprecation warnings when used with Vitest 4.1:

Importing from "vitest/runners" is deprecated since Vitest 4.1. Please use "vitest" instead.
Importing from "vitest/suite" is deprecated since Vitest 4.1. Please use static methods of "TestRunner" from the "vitest" entry point instead: e.g., `TestRunner.getCurrentTest()`.

These warnings originate from the plugin's internal imports:

  • node_modules/@codspeed/vitest-plugin/dist/runners.js:19:9
  • node_modules/@codspeed/vitest-plugin/dist/suite.js:8:9

Environment

  • @codspeed/vitest-plugin: 5.2.0
  • vitest: 4.1.2
  • vite: 8.0.3 (via Vite+ vite-plus@0.1.15)
  • CodSpeed Action: v4.13.0
  • Mode: simulation
  • Runner: ubuntu-latest

Note on Vite+

This project uses Vite+ (vite-plus), a unified toolchain that bundles Vite, Vitest, and other tools. Vite and Vitest are not installed directly — they are provided by vite-plus. The versions of Vite (8.0.3) and Vitest (4.1.2) are resolved transitively through vite-plus@0.1.15.

The @codspeed/vitest-plugin peer dependency declaration currently specifies vite: ^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 and vitest: ^3.2 || ^4, so Vite 8.x as provided by Vite+ is technically outside the declared peer range, though it appears to work at runtime.

Reproduction

  1. Create a project with vitest@4.1.2 and @codspeed/vitest-plugin@5.2.0
  2. Add a benchmark file:
import { bench, describe } from "vitest";

describe("example", () => {
  bench("noop", () => {});
});
  1. Run vitest bench --run
  2. Observe deprecation warnings in stderr

Expected behavior

No deprecation warnings. The plugin should import from the vitest entry point instead of the deprecated vitest/runners and vitest/suite subpaths.

Additionally, it would be helpful to add vite: ^8.0.0 to the plugin's peer dependency range, as Vite 8 is now available via toolchains like Vite+.

CI logs

Full stderr output from the CodSpeed action step:

stderr | file:/home/runner/work/ja4/ja4/node_modules/.pnpm/vitest@4.1.2_@types+node@25.5.0_vite@8.0.3_@emnapi+core@1.9.1_@emnapi+runtime@1.9.1_@ty_9ae930c9106c2e325a0aaa7b6bbd4837/node_modules/vitest/dist/runners.js:19:9
Importing from "vitest/runners" is deprecated since Vitest 4.1. Please use "vitest" instead.

stderr | file:/home/runner/work/ja4/ja4/node_modules/.pnpm/vitest@4.1.2_@types+node@25.5.0_vite@8.0.3_@emnapi+core@1.9.1_@emnapi+runtime@1.9.1_@ty_9ae930c9106c2e325a0aaa7b6bbd4837/node_modules/vitest/dist/suite.js:8:9
Importing from "vitest/suite" is deprecated since Vitest 4.1. Please use static methods of "TestRunner" from the "vitest" entry point instead: e.g., `TestRunner.getCurrentTest()`.

You can check that logs at my PR: hckhanh/ja4#20

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions