drizzle-team / drizzle-team/drizzle-orm

[BUG]: postgres-node mock `client.query is not a function`

Open
#4,177 7 comments 21 reactions 0 assignees View on GitHub
docs docs/undocumented priority
Dominant language
TypeScript
Stars
35.8k
Forks
1.6k
Avg merge
2d 7h
Merged PRs (30d)
4

Description

### Report hasn't been filed before.

- [x] I have verified that the bug I'm about to report hasn't been filed before.

### What version of `drizzle-orm` are you using?

0.40.0

### What version of `drizzle-kit` are you using?

0.30.5

### Other packages

drizzle-zod@0.7.0

### Describe the Bug

Attempting to use the provided postgres mock:

```typescript
import { drizzle } from "drizzle-orm/node-postgres"
...
const db = drizzle.mock({ schema })
```

Is giving the following error when tests are run. [The docs](https://orm.drizzle.team/docs/goodies#mock-driver) don't describe what this mock is or how it functions, so I'm not sure what to expect.

```
TypeError: client.query is not a function
❯ ../../node_modules/src/node-postgres/session.ts:100:20
❯ Object.startActiveSpan ../../node_modules/src/tracing.ts:27:11
❯ ../../node_modules/src/node-postgres/session.ts:94:19
❯ Object.startActiveSpan ../../node_modules/src/tracing.ts:27:11
❯ NodePgPreparedQuery.execute ../../node_modules/src/node-postgres/session.ts:86:17
❯ ../../node_modules/src/pg-core/query-builders/insert.ts:422:27
❯ Object.startActiveSpan ../../node_modules/src/tracing.ts:27:11
❯ QueryPromise.execute ../../node_modules/src/pg-core/query-builders/insert.ts:421:17
❯ QueryPromise.then ../../node_modules/src/query-promise.ts:31:15
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.