vitest: Performance regression between 0.33.0 and 0.34.X
Describe the bug
The same test suite:
- With version
0.33.0
:yarn test 202.70s user 31.13s system 634% cpu 36.857 total
- With version
0.34.0
:yarn test 293.07s user 42.05s system 311% cpu 1:47.58 total
- With version
0.34.1
:yarn test 291.66s user 43.37s system 306% cpu 1:49.16 total
Keywords: performance, time
Reproduction
I can’t publish all the test we have in the private project, but this is the configuration we use:
/// <reference types="vitest" />
import path from 'path';
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
import tsconfigPaths from 'vite-tsconfig-paths';
import pkg from './package.json';
export default defineConfig({
plugins: [
react(),
vanillaExtractPlugin(),
tsconfigPaths(),
dts({
entryRoot: './src',
exclude: [
'node_modules',
'dist',
'**/*.stories.*',
'**/*.test.*',
'**/*.test-acceptance.*',
],
}),
{
name: 'remove-ensure-watch-plugin',
enforce: 'post',
configResolved: config => {
// https://github.com/vitejs/vite/issues/13342
(config as any).plugins = config.plugins.filter(
p => p?.name !== 'vite:ensure-watch'
);
},
},
],
build: {
emptyOutDir: false,
lib: {
entry: 'src/index.ts',
formats: ['es'],
fileName: 'index',
},
sourcemap: true,
rollupOptions: {
external: [/@private/, 'classnames', 'react', 'react-dom'],
output: {
manualChunks: Object.fromEntries(
Object.keys(pkg.dependencies)
.filter(
dependency => !dependency.startsWith('@private')
)
.map(dependency => [dependency, [dependency]])
),
},
},
},
test: {
globals: true,
environment: 'jsdom',
include: ['src/**/*.test.{ts,tsx}'],
setupFiles: './src/setupTests.tsx',
alias: [
{
find: '@private-app/api',
replacement: path.resolve(__dirname, '../api/src'),
},
{
find: /@private-app\/core\/(.+)/,
replacement: path.resolve(__dirname, '../core/src/$1'),
},
],
},
});
With the exact same sourcecode, just upgrading the vitest dependency from 0.33.0 to 0.34.1, the test time grows significantly
This is one of the runs inside the CI Linux agent:
System Info
Reproduced in:
* MacBook Pro with macOS 13.1.
* Linux virtual machine inside TeamCity CI agent.
Used Package Manager
yarn
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Reactions: 5
- Comments: 19 (8 by maintainers)
Commits related to this issue
- :fire: #77 以下のissueがクローズされているので testTransformMode は不要と判断して削除 https://github.com/vitest-dev/vitest/issues/3967 — committed to nekochans/ai-cat-frontend by keitakn 5 months ago
If you add
test.testTransformMode.ssr: ['**/*']
does it return to the previous speed?This should be fixed in Vitest 1.1.2.
Not helpful since I don’t see the code and config.
I’ve upgraded vitest to the latest version and I can also confirm that ghe fix works, thank you so much for the effort!
@sheremet-va It works amazingly well! Thanks and congrats!
Vitest passes down
mode
astest
, and also setsVITEST
env variable, so you can conditionally remove it:Or:
Any update here? still experiencing this
Can you send your resolved config that is printed with
DEBUG=vite:config vitest
?