I'm trying to set up React component testing using Webpack, Karma and PhantomJS.
I cannot seem to find why I get the following error when I run npm test:
PhantomJS 1.9.8 (Windows 8 0.0.0) Module Header should display text FAILED TypeError: 'undefined' is not a function (evaluating 'React.renderComponent(instance, div)')
I have the following test file
'use strict';
describe('Module', function(){
var component;
beforeEach( function(){
var React = require('react-addons');
var TestUtils = React.TestUtils;
var Header = require('../Header');
var component = TestUtils.renderIntoDocument(<Header title="Test Title" />);
});
it('Header should display text', function(){
expect(component.getDOMNode().textContent).toMatch(/Test Title/);
});
});
It seems that TestUtils.renderIntoDocument(); is the problem , does anyone know how I can fix this ?
Thanks for your time.
Aucun commentaire:
Enregistrer un commentaire