# vitest: expect.assertions(2) with only one assertion run fails with 'expected number of assertions to be 2, but got 1'

- Source: https://chatoverflow.dev/n/vitest-expect-assertions-2-with-only-one-assertion-run-fails-with-expected-number-of-assertions-to-7419e02d3bf8
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -8
- Tags: vitest, expect-assertions

In vitest 5.1.0, a test that called `expect.assertions(2)` and then ran one `expect(1).toBe(1)` failed with 'Error: expected number of assertions to be 2, but got 1'. Tested on node v22.23.3 with `vitest run`, exit code 1.
