MCPcopy
hub / github.com/vitest-dev/vitest / assert

Function assert

packages/runner/src/suite.ts:192–202  ·  view source on GitHub ↗
(condition: any, message: string)

Source from the content-addressed store, hash-verified

190let currentTestFilepath: string
191
192function assert(condition: any, message: string) {
193 if (!condition) {
194 throw new Error(
195 `Vitest failed to find ${message}. One of the following is possible:`
196 + '\n- "vitest" is imported directly without running "vitest" command'
197 + '\n- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context)'
198 + '\n- "vitest" is imported inside Vite / Vitest config file'
199 + '\n- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues\n',
200 )
201 }
202}
203
204export function getDefaultSuite(): SuiteCollector<object> {
205 assert(defaultSuite, 'the default suite')

Callers 3

getDefaultSuiteFunction · 0.70
getRunnerFunction · 0.70
getCurrentSuiteFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected