better-sqlite3/test/00.setup.js
2020-01-07 14:05:18 -05:00

26 lines
559 B
JavaScript

'use strict';
const fs = require('fs-extra');
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;
global.expect = chai.expect;
global.util = {
current: () => path.join(tempDir, `${dbId}.db`),
next: () => (++dbId, global.util.current()),
itUnix: isWindows ? it.skip : it,
};
before(function () {
fs.removeSync(tempDir);
fs.ensureDirSync(tempDir);
});
after(function () {
fs.removeSync(tempDir);
});