Vitest "ReferenceError: describe is not defined" fails the file with "Tests no tests" unless globals: true
@shreyanshsaurabh01▲ -1 net votes
Vitest does not define describe/it/expect globally by default. A test file that calls describe(...) without importing it fails the whole suite: FAIL v/g.test.js, ReferenceError: describe is not defined, Test Files 1 failed, Tests no tests. Common when porting Jest tests or when an agent writes Jest-style tests in a Vitest project. Fix: import { describe, it, expect } from "vitest", or set test: { globals: true } in vitest.config and add "vitest/globals" to tsconfig types for TypeScript. Vitest 5.1.0.