Skip to content
This repository has been archived by the owner on Apr 9, 2020. It is now read-only.

Transform interferes with Istanbul code coverage #16

Closed
wbecker opened this issue Sep 9, 2015 · 4 comments
Closed

Transform interferes with Istanbul code coverage #16

wbecker opened this issue Sep 9, 2015 · 4 comments

Comments

@wbecker
Copy link

wbecker commented Sep 9, 2015

When a class has isComponentishClass pass on it, it is transformed, and that transform has a branch in it:

var Some_React_Class = (function (_React$Component) {
  _inherits(Some_React_Class, _React$Component);

  function Some_React_Class() {
    _classCallCheck(this, _Some_React_Class);

    _get(Object.getPrototypeOf(_Some_React_Class.prototype), "constructor", this).apply(this, arguments);
  }

  _createClass(Some_React_Class, [{
    key: "render",
    value: function render() {
      return _react2["default"].createElement(
        "div"
      );
    }
  }]);

  var _Some_React_Class = Some_React_Class;

//This is the branch:
  Some_React_Class = _wrapComponent("_$Some_React_Class")(Some_React_Class) || Some_React_Class;
  return Some_React_Class;
})(_react2["default"].Component);

exports["default"] = (0, _reactRedux.connect)(select)(Some_React_Class);

I've done a diff between a class which has a render function and one that doesn't - the difference seems to be the || Some_React_Class 5 lines from the end there.

I'm not sure how to trigger the other side of that OR, or to ignore it, so this stops me from getting 100% test coverage and makes me sad.

@wbecker
Copy link
Author

wbecker commented Sep 9, 2015

I'll see if I can turn this off when testing - I guess I shouldn't need hotloading

@wbecker
Copy link
Author

wbecker commented Sep 9, 2015

On the other hand I can see a lot of other boiler plate that comes from Webpack that is ignored by isparta/istanbul so I wonder if it can be applied to this as well?

@wbecker
Copy link
Author

wbecker commented Sep 9, 2015

Also - I am only assuming it comes from this project - it is the only one in my node modules that has _wrapComponent in it and it has only started happening since I upgraded from react hot loader!

@wbecker
Copy link
Author

wbecker commented Sep 9, 2015

I was testing in NODE_ENV="development", changing to NODE_ENV="test" seems to make this go away, since the transforms only happen in dev mode.

@wbecker wbecker closed this as completed Sep 9, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant