-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Cannot read property 'text' of undefined #5
Comments
Had the same issue, occurs if you sourcemaps are not found, check out this module: https://github.com/jas-chen/karma-sourcemap-writer. I added this to my config, now it's working fine. |
+1 had the same issue @ReToCode Thanks! Was finally able to get my setup working after literally days of trying different combinations. karma-sourcemap-writer is really designed to work with example usage provided by karma-webpack |
This error was also happening to me while running the remap code by hand. I observed this was an issue with that tool SitePen/remap-istanbul/issues/86. After finding a proper version I decided to automate it with Grunt, but the error came back using karma-remap-istanbul and a working version of remap-instanbul. I even tried karma-sourcemap-writer but without success. |
Would it be possible for anyone still experiencing this issue to share a minimal repo that reproduces the issue and I can dig in and try and work out what's going wrong. 😃 |
This hack works ... Focus: gotwarlost/istanbul#603 Proof-of-Concept:.babel.rc{
"plugins": [
"transform-class-properties",
"transform-flow-strip-types",
"discard-module-references"
],
"presets": [
"es2015"
]
} Move all class property initializations in the constructorBefore: // @flow
import CommonComponent from '../common.component';
import VertragPartnerType from '../../types/vertrag-partner.type';
export default class VertragspartnerComponent extends CommonComponent {
partner: VertragPartnerType = null;
constructor($scope: any) {
super($scope);
}
} After: // @flow
import CommonComponent from '../common.component';
import VertragPartnerType from '../../types/vertrag-partner.type';
export default class VertragspartnerComponent extends CommonComponent {
partner: VertragPartnerType;
constructor($scope: any) {
super($scope);
this.partner = null;
}
} LoC in child classesBefore: // @flow
import CommonComponent from '../common.component';
import VertragPartnerType from '../../types/vertrag-partner.type';
export default class VertragspartnerComponent extends CommonComponent {
partner: VertragPartnerType;
constructor($scope: any) {
super($scope);
this.partner = null;
}
} After: // @flow
import CommonComponent from '../common.component';
import VertragPartnerType from '../../types/vertrag-partner.type';
export default class VertragspartnerComponent extends CommonComponent {
partner: VertragPartnerType;
constructor($scope: any) {
super($scope);
this.partner = null;
}
}
|
@martinoppitz if you're using babel I'd highly recommend just using the istanbul babel plugin instead of this module. It's less buggy as it doesn't involve any sourcemaps and provides much more accurate coverage. |
All in a sudden, it's giving these errors. It was working fine before. Any idea? Thanks.
18 04 2016 21:59:49.177:ERROR [karma]: [TypeError: Cannot read property 'text' of undefined]
TypeError: Cannot read property 'text' of undefined
at node_modules/remap-istanbul/node_modules/istanbul/lib/report/html.js:286:59
at Array.forEach (native)
at annotateBranches (node_modules/remap-istanbul/node_modules/istanbul/lib/report/html.js:255:30)
at HtmlReport.Report.mix.writeDetailPage (node_modules/remap-istanbul/node_modules/istanbul/lib/report/html.js:426:9)
at node_modules/remap-istanbul/node_modules/istanbul/lib/report/html.js:489:26
at SyncFileWriter.extend.writeFile (node_modules/remap-istanbul/node_modules/istanbul/lib/util/file-writer.js:57:9)
at FileWriter.extend.writeFile (node_modules/remap-istanbul/node_modules/istanbul/lib/util/file-writer.js:147:23)
at node_modules/remap-istanbul/node_modules/istanbul/lib/report/html.js:488:24
at Array.forEach (native)
at HtmlReport.Report.mix.writeFiles (node_modules/remap-istanbul/node_modules/istanbul/lib/report/html.js:482:23)
at node_modules/remap-istanbul/node_modules/istanbul/lib/report/html.js:484:22
at Array.forEach (native)
at HtmlReport.Report.mix.writeFiles (node_modules/remap-istanbul/node_modules/istanbul/lib/report/html.js:482:23)
at HtmlReport.Report.mix.writeReport (node_modules/remap-istanbul/node_modules/istanbul/lib/report/html.js:566:14)
at node_modules/remap-istanbul/lib/writeReport.js:61:22
at node_modules/amdefine/amdefine.js:125:34
at _combinedTickCallback (internal/process/next_tick.js:67:7)
at process._tickCallback (internal/process/next_tick.js:98:9)
The text was updated successfully, but these errors were encountered: