code-server/scripts/test-setup.js

24 lines
490 B
JavaScript
Raw Normal View History

const fs = require("fs");
const util = require("util");
// This isn't properly promisified in Jest.
Object.defineProperty(fs.read, util.promisify.custom, {
configurable: true,
value: (...args) => {
return new Promise((resolve, reject) => {
args.push((error, bytesRead, buffer) => {
if (error) {
reject(error);
} else {
resolve({ bytesRead, buffer });
}
});
fs.read(...args);
});
},
});
2019-01-08 08:46:19 +08:00
global.requestAnimationFrame = (cb) => {
setTimeout(cb, 0);
};