Home / Function/ mock() — drizzle-orm Function Reference

mock() — drizzle-orm Function Reference

Architecture documentation for the mock() function in driver.ts from the drizzle-orm codebase.

Entity Profile

Dependency Diagram

graph TD
  c5849a22_0539_9f75_525b_43480a230db9["mock()"]
  e62c4bff_79fa_8bf4_2716_485f05b01506["driver.ts"]
  c5849a22_0539_9f75_525b_43480a230db9 -->|defined in| e62c4bff_79fa_8bf4_2716_485f05b01506
  226e224f_f0a8_06f1_40cc_c34d7ea89dfa["construct()"]
  c5849a22_0539_9f75_525b_43480a230db9 -->|calls| 226e224f_f0a8_06f1_40cc_c34d7ea89dfa
  style c5849a22_0539_9f75_525b_43480a230db9 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

drizzle-orm/src/node-postgres/driver.ts lines 143–149

	export function mock<TSchema extends Record<string, unknown> = Record<string, never>>(
		config?: DrizzleConfig<TSchema>,
	): NodePgDatabase<TSchema> & {
		$client: '$client is not available on drizzle.mock()';
	} {
		return construct({} as any, config) as any;
	}

Domain

Subdomains

Calls

Frequently Asked Questions

What does mock() do?
mock() is a function in the drizzle-orm codebase, defined in drizzle-orm/src/node-postgres/driver.ts.
Where is mock() defined?
mock() is defined in drizzle-orm/src/node-postgres/driver.ts at line 143.
What does mock() call?
mock() calls 1 function(s): construct.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free