Skip to content

Make vitest actually bail after the first failure when --bail is set to 1 #3372

@gajus

Description

@gajus

Clear and concise description of the problem

At the moment, running tests vitest run --bail 1 --single-thread allows tests to continue running after the first (and many more) failures.

 Test Files  8 failed | 36 passed (44)
      Tests  33 failed | 82 passed | 2 skipped | 2 todo (119)
   Start at  15:04:35
   Duration  16.44s (transform 179ms, setup 0ms, collect 2.71s, tests 13.04s, environment 1ms, prepare 147ms)

Suggested solution

If --bail is set to 1, vitest should terminate all runners are soon as possible and return information about the first failure.

Alternative

No response

Additional context

  • I tried --single-thread to no different effect
  • I tried --no-threads to no different effect

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions