vitest/docs/config/allowonly.md
2025-11-06 14:59:05 +01:00

1.1 KiB

title outline
allowOnly | Config deep

allowOnly

  • Type: boolean
  • Default: !process.env.CI
  • CLI: --allowOnly, --allowOnly=false

By default, Vitest does not permit tests marked with the only flag in Continuous Integration (CI) environments. Conversely, in local development environments, Vitest allows these tests to run.

::: info Vitest uses std-env package to detect the environment. :::

You can customize this behavior by explicitly setting the allowOnly option to either true or false.

::: code-group

import { defineConfig } from 'vitest/config'

export default defineConfig({
  test: {
    allowOnly: true,
  },
})
vitest --allowOnly

:::

When enabled, Vitest will not fail the test suite if tests marked with only are detected, including in CI environments.

When disabled, Vitest will fail the test suite if tests marked with only are detected, including in local development environments.