test: fix Vitest segmentation fault (#13415)

This commit is contained in:
neverland
2025-03-29 18:15:00 +08:00
committed by GitHub
parent e99a050796
commit 6ed3fc817b
2 changed files with 3 additions and 13 deletions
@@ -204,7 +204,7 @@ exports[`should render demo and match snapshot 1`] = `
Y Y
</span> </span>
<span <span
class="van-index-bar__index van-index-bar__index--active" class="van-index-bar__index"
data-index="Z" data-index="Z"
> >
Z Z
@@ -911,8 +911,8 @@ exports[`should render demo and match snapshot 1`] = `
</div> </div>
</div> </div>
<div> <div>
<div style="height: 0px;"> <div>
<div class="van-index-anchor van-index-anchor--sticky van-hairline--bottom"> <div class="van-index-anchor">
Z Z
</div> </div>
</div> </div>
-10
View File
@@ -1,9 +1,6 @@
import { defineConfig } from 'vitest/config'; import { defineConfig } from 'vitest/config';
import vitePluginVue from '@vitejs/plugin-vue'; import vitePluginVue from '@vitejs/plugin-vue';
import vitePluginJsx from '@vitejs/plugin-vue-jsx'; import vitePluginJsx from '@vitejs/plugin-vue-jsx';
import { cpus } from 'os';
const cpuNum = Math.max(cpus().length - 1, 1);
export default defineConfig({ export default defineConfig({
test: { test: {
@@ -20,13 +17,6 @@ export default defineConfig({
reporter: ['lcov', 'text-summary'], reporter: ['lcov', 'text-summary'],
reportsDirectory: './test/coverage', reportsDirectory: './test/coverage',
}, },
pool: 'vmThreads',
poolOptions: {
vmThreads: {
// limit the memory to avoid OOM
memoryLimit: Math.min(1 / (cpuNum * 2), 0.1),
},
},
environment: 'jsdom', environment: 'jsdom',
include: ['src/**/*.spec.[jt]s?(x)'], include: ['src/**/*.spec.[jt]s?(x)'],
restoreMocks: true, restoreMocks: true,