ten*_*gen 8 gruntjs karma-runner
我试图用这个种子项目作为模型来连接Karma测试运行器.
我拉进了种子项目,构建它,测试运行器运行良好.
当我编辑karma.conf.js配置文件以开始包含我的项目中的文件,并将其移动到我当前的设置(种子项目之外)时,我收到此错误:
Running "karma:dev" (karma) task
ERROR [config]: Error in config file!
[ReferenceError: JASMINE is not defined]
ReferenceError: JASMINE is not defined
at module.exports (C:\dev_AD_2014.01_PHASE1\config\karma-dev.conf.js:4:7)
...
Run Code Online (Sandbox Code Playgroud)
我想我看到它在抱怨......在种子工程,这是因果报应的配置文件是较旧的格式,即必须有JASMINE和JASMINE_ADAPTER地方规定:
种子项目业力配置片段
files = [
JASMINE,
JASMINE_ADAPTER,
'../app/lib/angular/angular.js',
'lib/angular/angular-mocks.js',
'../app/js/*.js',
....
];
exclude = ['karma.conf.js'];
...
Run Code Online (Sandbox Code Playgroud)
我的新设置使用了所有最新的grunt插件,并希望配置文件包含在模块定义中,如下所示:
我的业力配置片段
module.exports = function(config) {
config.set({
files: [
JASMINE,
JASMINE_ADAPTER,
// library and vendor files
'../dev/vendor/**/*.js'
'../dev/app/**/*.js'
],
exclude: ['**/*.e2e.js', '../config/*.js'],
reporters: ['progress'],
...
Run Code Online (Sandbox Code Playgroud)
所以看起来问题很清楚:一些grunt插件的较新版本需要模块化定义,但是设置JASMINE等等更长,因为它们是定义的变量.这是我的猜测,但我对如何解决这个问题感到有点迷茫.如果我可以帮助它,我不想使用种子项目附带的Karma版本......我认为它的版本是0.4.4.我相信最新的稳定版本是0.10.x.
我究竟做错了什么?
谢谢!
gle*_*tre 13
如果你想使用最新的稳定Karma版本(0.10.9),你应该在该frameworks部分定义Jasmine,并确保plugins在你的karma配置文件中的部分中有karma-jasmine .
这是一个示例配置文件:
karma.conf.js
module.exports = function(config){
config.set({
// base path, that will be used to resolve files and exclude
basePath: '',
// list of files / patterns to load in the browser
files: [
{pattern: 'app/**/*.js', watched: true, included: true, served: true}
],
// list of files to exclude
exclude: [
],
preprocessors: {
},
proxies: {
},
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
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_INFO,
autoWatch: true,
// frameworks to use
frameworks: ['jasmine'],
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera
// - Safari (only Mac)
// - PhantomJS
// - IE (only Windows)
browsers: [
'Chrome'
],
plugins: [
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-script-launcher',
'karma-jasmine'
],
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
});
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
11877 次 |
| 最近记录: |