Skip to content

Instantly share code, notes, and snippets.

View hypeJunction's full-sized avatar

Ismayil Khayredinov hypeJunction

View GitHub Profile
export const StateMachineContext = React.createContext()
export function StateMachine ({
states,
initialContext,
initialState,
children,
}) {
const [context, setContext] = useState(initialContext)
const [state, setState] = useState(initialState)
context('To Do Items', () => {
it('Should display a list of to do items', () => {
cy.intercept({
method: 'GET',
url: new RegExp(`${REACT_APP_TODO_API_URL}/v1/to-dos`)
}, {
fixture: 'todos.json`
}).as('loadToDos');
cy.visit('/');
import { REACT_APP_TODO_API_URL } from './constants.js';
cy.intercept({
method: 'GET',
url: new RegExp(`${REACT_APP_TODO_API_URL}`/v1/to-dos`)
}, {
fixture: 'todos.json`
})
REACT_APP_TODO_API_URL=http://somewhere-over-the-rainbow.io
{
"scripts": {
"start": "PORT=3000 react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"serve": "http-server ./build -p 3000 --proxy http://localhost:3000?",
"cy:open": "CYPRESS_BASE_URL=http://localhost:3000 cypress open",
"cy:run": "CYPRESS_BASE_URL=http://localhost:3000 cypress run",
"cy:ci": "start-server-and-test serve http://localhost:3000 cy:run"
// config-overrides.js
const fs = require('fs');
const path = require('path');
const {
override,
removeModuleScopePlugin,
babelInclude,
addWebpackAlias,
} = require('customize-cra');
// @me/my-local-package/package.json
{
"peerDependencies": {
"react": ">=16.0.0",
"react-dom": ">=16.0.0"
},
"devDependencies": {
"react": "^16.13.0",
"react-dom": "^16.13.0"
}
// config-overrides.js
const fs = require('fs');
const path = require('path');
const {
override,
removeModuleScopePlugin,
babelInclude,
} = require('customize-cra');
module.exports = override(
// config-overrides.js
const {
override,
removeModuleScopePlugin,
} = require('customize-cra');
module.exports = override(
removeModuleScopePlugin()
);
// config-overrides.js
const { override } = require('customize-cra');
module.exports = override();