Javascript 因果报应茉莉花无法读取属性';clearTimeout';
我似乎无法让karma jasmine工作 如果我运行Javascript 因果报应茉莉花无法读取属性';clearTimeout';,javascript,karma-runner,karma-jasmine,Javascript,Karma Runner,Karma Jasmine,我似乎无法让karma jasmine工作 如果我运行karma start我会得到以下错误: Chrome 37.0.2062(Windows 8.1)错误未捕获类型错误:无法读取 在处未定义的属性“clearTimeout” [censtered]/node_modules/karma jasmine/lib/jasmine.js:1826 这是我用karma init构建的配置文件 我修改了文件、日志和单次运行字段 module.exports = function(config) {
karma start
我会得到以下错误:
Chrome 37.0.2062(Windows 8.1)错误未捕获类型错误:无法读取
在处未定义的属性“clearTimeout”
[censtered]/node_modules/karma jasmine/lib/jasmine.js:1826
这是我用karma init
构建的配置文件
我修改了文件、日志和单次运行字段
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
});
};
这是它似乎被扼杀的功能
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);
}
};
这里有什么明显的错误吗?我所做的其他一切都是通过nodejs进行的库存安装工作。我现在觉得很没用。问题是由于在文件字段中重新加载jasmine文件(除了框架之外) 解决办法是删除
'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',
谢谢,我也做了同样的事。。。我也觉得没用:)