MCPcopy Create free account
hub / github.com/WiseLibs/better-sqlite3 / testTimeout

Function testTimeout

test/10.database.open.js:95–106  ·  view source on GitHub ↗
(timeout)

Source from the content-addressed store, hash-verified

93 util.itUnix('should accept the "timeout" option', function () {
94 this.slow(5000);
95 const testTimeout = (timeout) => {
96 const db = new Database(util.current(), { timeout });
97 try {
98 const start = Date.now();
99 expect(() => db.exec('BEGIN EXCLUSIVE')).to.throw(Database.SqliteError).with.property('code', 'SQLITE_BUSY');
100 const end = Date.now();
101 // GHA is slow: a 500ms timeout can take 1685ms to fail.
102 expect(end - start).to.be.within(timeout - 1, timeout * 3 + 300);
103 } finally {
104 db.close();
105 }
106 };
107 const blocker = this.db = new Database(util.next(), { timeout: 0x7fffffff });
108 blocker.exec('BEGIN EXCLUSIVE');
109 testTimeout(0);

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected