A Node.js library for managing Microsoft SQL Server databases with built-in mocking capabilities for testing. Version 1.0.0 provides an easy-to-use API for executing stored procedures, queries, and transactions, with special support for mocking procedure returns via JSON files for unit tests. It includes an Express middleware for request-scoped SQL contexts and supports a variety of SQL Server types. The library is primarily used in development and testing environments where database mocking is needed.
npm install sql-mochaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to initialize a Sql instance with environment variables and execute a stored procedure.
Set environment variable and create a valid mocha.json.
Ensure parameters are passed as `{ input: value, $output: type }`.Call Context.middleware(app, config) before defining routes.
Ensure you `await sql.execute(...)` and that `sql` is a valid Sql instance.
Create a mocha.json file in the same directory as the file calling sql.execute.
Check database name in config and that table exists.