mirror of https://git.tuxpa.in/a/code-server.git
24 lines
490 B
JavaScript
24 lines
490 B
JavaScript
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);
|
|
});
|
|
},
|
|
});
|
|
|
|
global.requestAnimationFrame = (cb) => {
|
|
setTimeout(cb, 0);
|
|
};
|