In this lesson we will shallow render a component and pass through different config options. Shallow rendering is useful to test components as individual units. This helps ensure that tests aren’t indirectly asserting on behavior of child components. We’ll also use the debug method to show how we can easily view our component for debugging purposes.
Why is it returning me the following error after running the script npm test
Error: Cannot find module 'C:\Users\username\courses\test-react-components-with-enzyme-and-jest\node_modules\jest-cli'
I was having trouble getting things running, but once I created the project with create-react-app and ignored the advice to replace the test script in the package.json file with jest, I was finally able to start seeing the results shown in the video.
I don't understand, how can you pass a test when there is no expect
? Shouldn't you be adding expect(wrapper).toMatchSnapshot();
?
Is it true that we shouldn't use arrow functions with mocha? Are we even using mocha in this context or is describe
here referring to something else?
Getting ReferenceError: bool is not defined
when adding context
and disableLifecycleMethods
to the wrapper function. Has anyone else seen this?
To anyone having issues with bool
being undefined I believe it's pseudocode here.
Use true
or false
👍