Taken from cube.js
/* globals jest */
/* eslint-disable no-underscore-dangle */
const https = jest.requireActual('https');
https.__mockServer = {| import { FC, useState, useEffect, useContext, createContext, ReactElement } from 'react' | |
| const OnlineStateContext = createContext<boolean>(true) | |
| export const OnlineStateProvider: FC = ({ children }): ReactElement => { | |
| const [onlineState, setOnlineState] = useState<boolean>(true) | |
| useEffect(() => { | |
| window.addEventListener('offline', () => { | |
| setOnlineState(false) |
| { | |
| // See https://go.microsoft.com/fwlink/?LinkId=733558 | |
| // for the documentation about the tasks.json format | |
| "version": "2.0.0", | |
| "tasks": [ | |
| { | |
| "label": "NVM: set Node and NPM versions", | |
| "type": "shell", | |
| "command": "nvm use 14", | |
| "windows": { |
| const logBlue = (text: string) => | |
| console.log(`%c${text}\n`, 'color: blue; font-weight: 700') | |
| const logRed = (text: string) => | |
| console.log(`%c${text}\n`, 'color: red; font-weight: 700') | |
| const logGreen = (text: string) => | |
| console.log(`%c${text}\n`, 'color: green; font-weight: 700') |
Taken from cube.js
/* globals jest */
/* eslint-disable no-underscore-dangle */
const https = jest.requireActual('https');
https.__mockServer = {Taken from cube.js
/* globals jest */
/* eslint-disable no-underscore-dangle */
const http = jest.requireActual('http');
http.__mockServer = {
listen: jest.fn((opts, cb) => cb && cb(null)),