@tpacks/flexigrid
Version:
A library helps you make a grid with resizable and movable panes on it, just like Kibana dashboard
26 lines (24 loc) • 755 B
JavaScript
const Environment = require('jest-environment-jsdom');
const {TextEncoder, TextDecoder} = require('util');
const {randomBytes} = require('crypto');
/**
* A custom environment to set the TextEncoder that is required by TensorFlow.js.
*/
module.exports = class CustomTestEnvironment extends Environment {
async setup() {
await super.setup();
if (typeof this.global.TextEncoder === 'undefined') {
this.global.TextEncoder = TextEncoder;
}
if (typeof this.global.TextDecoder === 'undefined') {
this.global.TextDecoder = TextDecoder;
}
if (typeof this.global.crypto === 'undefined') {
this.global.crypto = {
getRandomValues(arr) {
return randomBytes(arr.length);
},
};
}
}
};