Expected behaviour
Karma should be running.
Actual behaviour
Not able to parse the paths given in the config.files and throw an error:
ERROR [karma]: TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.extname (path.js:887:5)
at d:\Test\test-karma\node_modules\.1.6.0@karma\lib\middleware\karma.js:181:32
at d:\Test\test-karma\node_modules\.1.6.0@karma\lib\middleware\common.js:117:36
at d:\Test\test-karma\node_modules\.4.1.11@graceful-fs\graceful-fs.js:78:16
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:439:3)
Environment Details
- Karma version (output of
karma --version): v1.6.0
- Node.js version:
v7.9.0
- Relevant part of your
karma.config.js file
module.exports = function (config) {
config.set({
browsers: ['PhantomJS'],
files: [
'./test.js'
],
singleRun: true,
// coverage reporter generates the coverage
reporters: ['progress'],
plugins: [
'karma-mocha',
'karma-phantomjs-launcher'
]
});
};
Steps to reproduce the behaviour
Run this snippet of script:
var Karma = require('karma').Server;
var path = require('path');
var fn = Array.prototype.indexOf;
delete Array.prototype['indexOf'];
Array.prototype['indexOf'] = function () {
return fn.apply(this, arguments);
};
new Karma({
configFile: path.resolve(__dirname, 'karma.conf.js')
}).start();
Cause
At this line in lib/middleware/karma.js:
for (var i in files.included)
for...in is used to traverse an array and this is a known bad practice. Maybe there is a particular reason for using it here?
Expected behaviour
Karma should be running.
Actual behaviour
Not able to parse the paths given in the
config.filesand throw an error:Environment Details
karma --version):v1.6.0v7.9.0karma.config.jsfileSteps to reproduce the behaviour
Run this snippet of script:
Cause
At this line in
lib/middleware/karma.js:for...inis used to traverse an array and this is a known bad practice. Maybe there is a particular reason for using it here?