Become a member
to unlock all features

Create an egghead account to access 5000+ tutorials and resources from expert developers.

Create account

    React TestUtils API has changed

    This lesson was recorded with an older version of React. With React 0.14, there are some breaking changes you should be aware of: component = TestUtils.renderIntoDocument(<Artist name="Run the Jewels" />); In any version above 0.13, this code will result in an error. To fix this, you must import the new test module and use the new methods to extract the value out of the DOM: import ReactTestUtils from 'react-addons-test-utils'; component = ReactTestUtils.renderIntoDocument( <Artist name="Run the Jewels" /> ); contents = ReactTestUtils.scryRenderedDOMComponentsWithClass(component, 'artist') Be aware that contents will return an array of items.

    Unit testing a React component using Jasmine and Webpack


    An introduction on unit testing a ReactJS component using Webpack and Jasmine. Learn how to use Webpack to package and import dependencies plus take advantage of the babel-loader to write a simple Jasmine spec using the latest ES6 syntax.