Run load tests
Load test files (<name>.load.ts) match buddyConfigDefaults.include.testLoad. Neither preset runs them unless you opt
in, and coverage never counts them as source.
-
Name load test files
<name>.load.ts(or.js,.cjs,.mjs,.cts,.mts) undersrc,source,code, ortests. -
Create a config that runs only load tests. Use
buddyConfigDefaultswithout a preset, because a preset always adds its own test globs:vitest.load.config.ts import { defineConfig } from 'vitest/config'import { buddyConfigDefaults } from '@repobuddy/vitest/config/node'export default defineConfig({test: {...buddyConfigDefaults.test,include: buddyConfigDefaults.include.testLoad,},})Do not name it
vitest.config.load.tswhen your root config usesprojects: ['vitest.config.*.ts']. That pattern would add it to every run. -
Add a script:
{"scripts": {"test:load": "vitest run --config vitest.load.config.ts"}}
To run load tests together with the other tests instead, pass includeLoadTests: true to the preset. Then every run of
that config includes them:
export default defineConfig({ plugins: [nodeTestPreset({ includeLoadTests: true })],})Finished config
Section titled “Finished config”import { defineConfig } from 'vitest/config'import { buddyConfigDefaults } from '@repobuddy/vitest/config/node'
export default defineConfig({ test: { ...buddyConfigDefaults.test, include: buddyConfigDefaults.include.testLoad, },})This config does not set TZ. Set it in the script (TZ=GMT vitest run ...) if your load tests depend on it.
Verify
Section titled “Verify”- Create
src/sum.load.tswith one test. - Run
pnpm test. The load test does not run. - Run
pnpm test:load. Only the load test runs.