Open jansoren opened 8 years ago
For anyone looking for a fix for this issue on the v1 branch, please see https://github.com/istanbuljs/istanbul-reports/pull/10
@levity - The PR you are referring to does not seem to fix the issue. Could you provide an example of how to use the istanbul-reports plugin?
@jansoren the v1 branch of istanbul depends on istanbul-reports. If you add a dependency on the patched version to your package.json, it will use that version. This doesn't apply to the master branch.
e.g.:
{
...
"devDependencies": {
...
"istanbul-reports": "levity/istanbul-reports"
}
}
@levity - Does still not work :-/ I'm not using istanbul
directly, I'm using istanbul-instrumenter-loader
. Could this be a problem?
That could certainly be a problem -- I don't have enough knowledge of the project to say for sure.
I can also confirm that I run into this issue. My project is based on the ReactJS Boilerplate template v3.3.0 with modifications. It uses webpack 2.2.0, babel-core 6.21.0, babel-plugin-istanbul 2.0.3, and my test runner is Karma 1.3.0 (with phantomJS)
I run into the issue when using Ternary operators that contain react-intl's FormattedMessage component.
The following code causes the coverage to fail with TypeError: Cannot read property 'text' of undefined
import React, { PropTypes } from 'react';
import { FormattedMessage } from 'react-intl';
import messages from './messages';
const FailingComponent = (condition) =>
<div>
{condition ? <FormattedMessage {...messages.messageId} /> : 'whatever is used here'}
</div>;
but the following code does causes these TypeError:
import React, { PropTypes } from 'react';
import { FormattedMessage } from 'react-intl';
import messages from './messages';
const WorkingComponent = (condition) => {
const message = <FormattedMessage {...messages.messageId} />;
return (<div>
{condition ? message : 'whatever is used here'}
</div>);
};
I can also confirm that the changes of this pull requests (applied locally in my node_modules copy of istanbul) fixes the errors caused by the the first snippet.
…roperty 'text' of undefined"