Install python-flamegraph into your project:
pip install git+https://github.com/evanhempel/python-flamegraph.git
Record a profile around a bit of code:
import flamegraph
thread = flamegraph.start_profile_thread(fd=open("./profile.log", "w"))
import { Modifier, EditorState, RichUtils } from 'draft-js'; | |
import getCurrentlySelectedBlock from './getCurrentlySelectedBlock'; | |
export const ALIGNMENTS = { | |
CENTER: 'center', | |
JUSTIFY: 'justify', | |
LEFT: 'left', | |
RIGHT: 'right' | |
}; |
Install python-flamegraph into your project:
pip install git+https://github.com/evanhempel/python-flamegraph.git
Record a profile around a bit of code:
import flamegraph
thread = flamegraph.start_profile_thread(fd=open("./profile.log", "w"))
Testing React components seems simple at first. Then you need to test something that isn't a pure interaction and things seem to break down. These 4 patterns should help you write readable, flexible tests for the type of component you are testing.
I recommend doing all setup in the most functional way possible. If you can avoid it, don't set variables in a
beforeEach
. This will help ensure tests are isolated and make things a bit easier to reason about. I use a pattern
that gives great defaults for each test example but allows every example to override props
when needed: