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

Function createHelpfulError

packages/mocker/src/registry.ts:315–323  ·  view source on GitHub ↗
(cause: Error)

Source from the content-addressed store, hash-verified

313}
314
315function createHelpfulError(cause: Error) {
316 const error = new Error(
317 '[vitest] There was an error when mocking a module. '
318 + 'If you are using "vi.mock" factory, make sure there are no top level variables inside, since this call is hoisted to top of the file. '
319 + 'Read more: https://vitest.dev/api/vi.html#vi-mock',
320 )
321 error.cause = cause
322 return error
323}
324
325function assertValidExports(raw: string, exports: any) {
326 if (exports === null || typeof exports !== 'object' || Array.isArray(exports)) {

Callers 1

resolveMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected