ignore timeout test in windows CI

This commit is contained in:
Joshua Thomas Wise
2019-08-05 11:48:59 -04:00
parent 5a0d533b45
commit 11a0c9d3aa
2 changed files with 7 additions and 5 deletions
+3 -1
View File
@@ -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 () {
+4 -4
View File
@@ -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);