ERROR [coverage]: [TypeError: Cannot call method 'split' of undefined]
See original GitHub issueI’m getting this error lately. Here is the full stack trace:
PhantomJS 1.9.8 (Linux): Executed 493 of 494 (skipped 1) SUCCESS (1.667 secs / 0.949 secs)
ERROR [coverage]: [TypeError: Cannot call method 'split' of undefined]
TypeError: Cannot call method 'split' of undefined
at HtmlReport.Report.mix.writeDetailPage (/home/foo/projects/replatform/httpd/node_modules/istanbul/lib/report/html.js:379:31)
at /home/foo/projects/replatform/httpd/node_modules/istanbul/lib/report/html.js:456:26
at SyncFileWriter.extend.writeFile (/home/foo/projects/replatform/httpd/node_modules/istanbul/lib/util/file-writer.js:57:9)
at FileWriter.extend.writeFile (/home/foo/projects/replatform/httpd/node_modules/istanbul/lib/util/file-writer.js:124:23)
at /home/foo/projects/replatform/httpd/node_modules/istanbul/lib/report/html.js:455:24
at Array.forEach (native)
at HtmlReport.Report.mix.writeFiles (/home/foo/projects/replatform/httpd/node_modules/istanbul/lib/report/html.js:449:23)
at /home/foo/projects/replatform/httpd/node_modules/istanbul/lib/report/html.js:451:22
at Array.forEach (native)
at HtmlReport.Report.mix.writeFiles (/home/foo/projects/replatform/httpd/node_modules/istanbul/lib/report/html.js:449:23)
at HtmlReport.Report.mix.writeReport (/home/foo/projects/replatform/httpd/node_modules/istanbul/lib/report/html.js:533:14)
at /home/foo/projects/replatform/httpd/node_modules/karma-coverage/lib/reporter.js:138:24
at /home/foo/projects/replatform/httpd/node_modules/karma/lib/helper.js:87:7
at Object.oncomplete (fs.js:107:15)
Here are my dependencies:
"devDependencies": {
"angular-cookies": "^1.3.5",
"bootstrap": "^3.3.0",
"brfs": "^1.2.0",
"browser-sync": "^1.6.3",
"browserify": "^6.2.0",
"browserify-istanbul": "^0.1.2",
"browserify-shim": "^3.8.0",
"chai": "^1.9.2",
"chalk": "^0.5.1",
"console-shim2": "0.1.0",
"csswring": "^1.3.1",
"del": "^0.1.3",
"event-stream": "^3.1.7",
"exorcist": "^0.1.6",
"fastclick": "^1.0.3",
"glob": "^4.0.6",
"gulp": "^3.8.9",
"gulp-changed": "^1.0.0",
"gulp-concat": "^2.4.1",
"gulp-flatten": "0.0.4",
"gulp-iconfont": "^0.2.1",
"gulp-if": "^1.2.5",
"gulp-insert": "^0.4.0",
"gulp-jasmine": "^1.0.1",
"gulp-jscs": "^1.2.1",
"gulp-jshint": "^1.9.0",
"gulp-karma": "0.0.4",
"gulp-less": "^1.3.6",
"gulp-load-plugins": "^0.7.1",
"gulp-ng-annotate": "^0.3.3",
"gulp-notify": "^2.0.0",
"gulp-postcss": "^2.0.0",
"gulp-rename": "^1.2.0",
"gulp-replace": "^0.5.0",
"gulp-sourcemaps": "^1.2.7",
"gulp-uglify": "^1.0.1",
"gulp-util": "^3.0.1",
"istanbul": "0.2.6",
"jshint-stylish": "^1.0.0",
"karma": "~0.12.0",
"karma-bro": "^0.9.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "~0.1.3",
"karma-coverage": "~0.2.6",
"karma-firefox-launcher": "~0.1",
"karma-html2js-preprocessor": "~0.1",
"karma-jasmine": "~0.2.0",
"karma-junit-reporter": "^0.2.2",
"karma-phantomjs-launcher": "~0.1.4",
"karma-sinon": "^1.0.3",
"karma-spec-reporter": "0.0.12",
"merge-stream": "^0.1.6",
"napa": "^1.0.2",
"ng-storage": "^0.3.1",
"path": "^0.4.9",
"pretty-hrtime": "^0.2.2",
"proxyquireify": "^1.1.0",
"require-dir": "^0.1.0",
"run-sequence": "^1.0.1",
"sax": "^0.6.1",
"sinon": "^1.10.3",
"sinon-chai": "^2.6.0",
"streamqueue": "^0.1.1",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.0.0",
"vinyl-transform": "0.0.1",
"watchify": "^2.1.1"
}
I’ve tried using the latest version of istanbul but that doesn’t help any. Is there any more info I can provode to help troubleshoot this?
Here’s my karma.conf.js
file:
// Karma configuration
// Generated on Fri Oct 17 2014 15:46:09 GMT-0700 (PDT)
module.exports = function(config) {
var options = {
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['chai', 'sinon', 'jasmine', 'browserify'],
// list of files / patterns to load in the browser
files: [
'node_modules/angular/angular.js',
'node_modules/angular-mocks/angular-mocks.js',
'src/test/chai-sinon-setup.js',
'src/test/**/*.js'
],
// list of files to exclude
exclude: [
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'src/main/**/*.js': ['browserify', 'coverage'],
'src/test/**/*.js': ['browserify']
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['spec', 'coverage'],
coverageReporter: {
reporters: [
{type: 'html', dir: 'coverage/'},
{type: 'cobertura'}
]
},
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [
//'Chrome'
'PhantomJS'
],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
// Browserify config (all optional)
browserify: {
// extensions: ['.coffee'],
// ignore: [],
plugin: ['proxyquireify/plugin'],
transform: ['brfs', 'browserify-istanbul'],
debug: false
// noParse: ['jquery'],
//watch: true,
},
plugins: [
// Karma will require() these plugins
'karma-bro',
'karma-chai',
'karma-spec-reporter',
'karma-sinon',
'karma-chrome-launcher',
'karma-phantomjs-launcher',
'karma-firefox-launcher',
'karma-jasmine',
'karma-coverage'
]
};
if (process.env.KARMA_BROWSER_NO_ACTIVITY_TIMEOUT) {
options.browserNoActivityTimeout = process.env.KARMA_BROWSER_NO_ACTIVITY_TIMEOUT;
}
config.set(options);
};
Issue Analytics
- State:
- Created 9 years ago
- Comments:32 (5 by maintainers)
Top Results From Across the Web
TypeError: Cannot call method "split" of undefined
I was calling my function from a cell in a google spreadsheet document like this "=myFunction(A1:A)" the problem was that, since there were...
Read more >Cannot Read Property 'split' of Undefined - freeCodeCamp
it will throw the TypeError: Cannot read property 'split' of undefined error. The split method. When split is called on a string, it...
Read more >Untitled
新建一个ts声明文件如:images. error: TypeError: Cannot read properties of undefined (readingIn this Angular tutorial, We are going to see how does Change ...
Read more >How to Prevent cannot read property split of undefined
The "cannot read property split of undefined" error occurs when we try to call the split() method on a variable that stores an...
Read more >Unconfirmed Errata - O'Reilly Media
The errata list is a list of errors and their corrections that were found after ... AssertionError: "TypeError: Cannot call method 'split' of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi,
I can see this has been closed as fixed but the issue still seems to exist.
These are my devDependencies:
And this is my config:
I’m on Windows in case that’s relevant… Locking the dependency for karma-coverage to 0.2.6 did not work for me unfortunately.
Yes, sorry for my mistake. I did it. However, the issue still be there.
I tried to do with
logLevel: config.LOG_DISABLE
in karma.conf.js file. The workaround works for me. But I’m not sure this is a good way.