Reputation: 11
I can't seem to get karma-jasmine working.
If I run karma start
I get this error:
Chrome 37.0.2062 (Windows 8.1) ERROR Uncaught TypeError: Cannot read property 'clearTimeout' of undefined at [censored]/node_modules/karma-jasmine/lib/jasmine.js:1826
This is my config file built with karma init
.
I've modified the files, logging, and single run fields
module.exports = function(config) {
config.set({
// 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: ['jasmine'],
// list of files / patterns to load in the browser
files: [
'test/jasmine/jasminetest.html',
'lib/bower/jquery/dist/jquery.min.js',
'lib/bower/jasmine/lib/jasmine-core/jasmine.js',
'lib/bower/jasmine/lib/jasmine-core/jasmine-html.js',
'lib/bower/jasmine/lib/jasmine-core/boot.js',
'bin/request.min.js',
'test/jasmine/specs/request/request.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: {
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],
// 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_DEBUG,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true
});
};
Here is the function it seems to be choking on
jasmine.getGlobal().clearTimeout = function(timeoutKey) {
if (jasmine.Clock.installed.clearTimeout.apply) {
return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
} else {
return jasmine.Clock.installed.clearTimeout(timeoutKey);
}
};
Is there anything that stands out wrong here? Everything else I've done is stock install work via nodejs.
Upvotes: 0
Views: 1000
Reputation: 11
I feel plenty useless right now. The problem was due to re-loading the jasmine files in the files field (in addition to frameworks)
The solution was to delete
'lib/bower/jasmine/lib/jasmine-core/jasmine.js',
'lib/bower/jasmine/lib/jasmine-core/jasmine-html.js',
'lib/bower/jasmine/lib/jasmine-core/boot.js',
Upvotes: 1