Skip to content

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.

js
import { defineConfig } from 'vitest/config'

export default defineConfig({
  test: {
    allowOnly: true,
  },
})
bash
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.

Released under the MIT License.