Skip to content

Instantly share code, notes, and snippets.

View annacoding2020's full-sized avatar

Anna Coding annacoding2020

View GitHub Profile
AWS ES cluster available at http://127.0.0.1:9200
Kibana available at http://127.0.0.1:9200/_plugin/kibana/
/usr/local/lib/node_modules/aws-es-kibana/node_modules/http-proxy/lib/http-proxy/index.js:120
throw err;
^
Error: socket hang up
at connResetException (internal/errors.js:609:14)
at TLSSocket.socketCloseListener (_http_client.js:402:25)
at TLSSocket.emit (events.js:326:22)
import { render } from "@testing-library/react";
test("username exists", () => {
const { queryByTestId } = render(
<Avatar username="Timonweb" src="https://example.com/avatar.jpg" />
);
expect(queryByTestId(/username/i)).toBeTruthy();
});
import { render } from "@testing-library/react";
test("username doesn't exist", () => {
const { queryByTestId } = render(
<Avatar
username="Timonweb"
src="https://example.com/avatar.jpg"
usernameIsHidden
/>
);
import { render } from "@testing-library/react";
test("username exists", () => {
const { getByTestId } = render(
<Avatar username="Timonweb" src="https://example.com/avatar.jpg" />
);
expect(getByTestId(/username/i).textContent).toBe("Timonweb");
});
function Avatar({ username, src, usernameIsHidden = false }) {
return (
<div>
<img src={src} />
{!usernameIsHidden && <h4 data-testid="username">{username}</h4>}
</div>
);
}
import React, { useState, lazy, Suspense } from 'react';
import IconButton from '@material-ui/core/IconButton';
import SettingsIcon from '@material-ui/icons/Settings';
const SettingDrawer = lazy(() => import('./SettingDrawer'));
// import SettingDrawer from './SettingDrawer'
{
"compilerOptions": {
...
"baseUrl": "src"
},
"include": ["src"]
}
<body>
<link rel="stylesheet/less" type="text/css" href="/color.less" />
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script>
window.less = {
async: false,
env: 'production'
};
</script>
const path = require('path');
const { generateTheme } = require('antd-theme-generator');
const options = {
stylesDir: path.join(__dirname, './src/theme'),
antDir: path.join(__dirname, './node_modules/antd'),
varFile: path.join(__dirname, './src/theme/vars.less'),
mainLessFile: path.join(__dirname, './src/theme/index.less'),
themeVariables: ['@primary-color', '@layout-header-background', '@menu-dark-color', '@font-size-base'],
indexFileName: 'index.html',
const path = require('path');
const { override, fixBabelImports, addLessLoader } = require('customize-cra')
const FilterWarningsPlugin = require('webpack-filter-warnings-plugin')
// filter out warning to prevent CI build failing
const filterWarningsPlugin = config => {
config.plugins.push(
new FilterWarningsPlugin({
exclude: /mini-css-extract-plugin/