mercredi 1 juin 2016

How to debug npm test?

I am writing front end unit tests for my react project. I am very new to it and was wondering how to go about debugging the uni tests. This is the first time I am writing tests here.

for e.g.

jest
    .unmock('../.././all_plans/decisionPanel');
var React = require('react');
var ReactDom = require('react-dom');
var testUtils = require('react-addons-test-utils');
var DecisionPanel = require('../.././all_plans/decisionPanel');
var $ = require('jquery');

describe('decisionPanel', () => {
    it('show panel mock', () => {
        $.getJSON("plan.json", function (json) {
           const panel = TestUtils.renderIntoDocument(
              <DecisionPanel plan={json} />
            );
            const panelNode = ReactDOM.findDOMNode(panel);
            console.log(panelNode);
        });
    });
});

How do I get those console.log to work ?

Aucun commentaire:

Enregistrer un commentaire