mirror of
https://github.com/hanzoai/better-sqlite3-multiple-ciphers.git
synced 2026-09-24 16:57:19 +00:00
ignore timeout test in windows CI
This commit is contained in:
+3
-1
@@ -4,6 +4,7 @@ const path = require('path');
|
||||
const os = require('os');
|
||||
const chai = require('chai');
|
||||
|
||||
const isWindows = os.platform().startsWith('win');
|
||||
const tempDir = path.join(__dirname, '..', 'temp');
|
||||
let dbId = 0;
|
||||
|
||||
@@ -11,7 +12,8 @@ global.expect = chai.expect;
|
||||
global.util = {
|
||||
current: () => path.join(tempDir, `${dbId}.db`),
|
||||
next: () => (++dbId, global.util.current()),
|
||||
describeUnix: os.platform().startsWith('win') ? describe.skip : describe,
|
||||
describeUnix: isWindows ? describe.skip : describe,
|
||||
itUnix: isWindows ? it.skip : it,
|
||||
};
|
||||
|
||||
before(function () {
|
||||
|
||||
@@ -112,15 +112,15 @@ describe('new Database()', function () {
|
||||
expect(db.inTransaction).to.be.false;
|
||||
expect(existsSync(util.current())).to.be.true;
|
||||
});
|
||||
it('should accept the "timeout" option', function () {
|
||||
this.slow(7000);
|
||||
util.itUnix('should accept the "timeout" option', function () {
|
||||
this.slow(4000);
|
||||
const testTimeout = (timeout) => {
|
||||
const db = new Database(util.current(), { timeout });
|
||||
try {
|
||||
const start = Date.now();
|
||||
expect(() => db.exec('BEGIN EXCLUSIVE')).to.throw(Database.SqliteError).with.property('code', 'SQLITE_BUSY');
|
||||
const end = Date.now();
|
||||
expect(end - start).to.be.closeTo(timeout, 1000);
|
||||
expect(end - start).to.be.closeTo(timeout, 100);
|
||||
} finally {
|
||||
db.close();
|
||||
}
|
||||
@@ -128,7 +128,7 @@ describe('new Database()', function () {
|
||||
const blocker = this.db = new Database(util.next(), { timeout: 0x7fffffff });
|
||||
blocker.exec('BEGIN EXCLUSIVE');
|
||||
testTimeout(0);
|
||||
testTimeout(3000);
|
||||
testTimeout(1000);
|
||||
blocker.close();
|
||||
expect(() => (this.db = new Database(util.current(), { timeout: undefined }))).to.throw(TypeError);
|
||||
expect(() => (this.db = new Database(util.current(), { timeout: null }))).to.throw(TypeError);
|
||||
|
||||
Reference in New Issue
Block a user