Skip to content

feat: extend Node mock with connections and statements - #420

Merged
chrispader merged 1 commit into
mainfrom
@chrispader/feat/mock-connections-and-statements
Oct 1, 2026
Merged

chrispader merged 1 commit into
mainfrom
@chrispader/feat/mock-connections-and-statements

Conversation

@chrispader

Copy link
Copy Markdown
Member

The Node test mock cannot exercise NitroSQLite 10 code that uses independent connections, prepared statements, or callback transactions. This extends react-native-nitro-sqlite/mock with those APIs and temporary database files, following Onyx PR #851. Hubert Sosinski authored the original Onyx mock; the existing attribution and MIT notice remain in place.

Connections share files by name and location, and read-only opens require an existing database. Prepared statements support repeated execution, fresh bindings, and finalization. The mock reuses the managed connection queue so callback transactions stay exclusive across await, commit on success, and roll back on error. Explicit commit and rollback also work.

Closing a connection now preserves its data for reopening. delete() removes the database, and resetAllDatabases() closes idle handles and removes every temporary file. The Node testing guide covers these lifecycles and limits, and TypeDoc now generates a separate reference for the mock export.

The integration tests cover rollback isolation, queue order, statement lifecycle, and a read-only WAL snapshot while another connection commits a write. SQL still runs on Node's thread, so native scheduling and performance require device tests.

@vercel

vercel Bot commented Oct 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
react-native-nitro-sqlite Ready Ready Preview Oct 1, 2026 8:55am UTC

Request Review

@chrispader
chrispader merged commit b934d7b into main Oct 1, 2026
13 of 14 checks passed

This branch was successfully deployed

1 active deployment
Preview — 6a6cb2b6 Deployed Oct 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant