警告和错误与噶/镀铬镀铬、错误

2023-09-13 02:47:24 作者:我拽我的『管你屁事』

刚学angularjs现在用书AngularJS并运行由O'Reilly ..得与噶和放大器单元测试的篇章;茉莉,但有麻烦使其工作

Just learning angularjs right now with the book 'AngularJS Up and Running' from O'Reilly.. Got to the chapter on unit testing with Karma & Jasmine, but having trouble making it work

编辑:更改日志级别到现在config.LOG_DEBUG匹配正确的文件模式。但我仍然有最终的适配器的错误在最后。

Changing logLevel to config.LOG_DEBUG now matches file patterns correctly. But I still have the ultimate 'adapter' error at the end.

运行因果报应的开始的命令给了我以下内容:

running the 'karma start' command gives me the following:

DEBUG [plugin]: Loading karma-* from /Work/[lab]/angularjs-up-and-running/chapter3/node_modules
DEBUG [plugin]: Loading plugin /Work/[lab]/angularjs-up-and-running/chapter3/node_modules/karma-chrome-launcher.
DEBUG [plugin]: Loading plugin /Work/[lab]/angularjs-up-and-running/chapter3/node_modules/karma-jasmine.
INFO [karma]: Karma v0.12.16 server started at http://localhost:8080/
INFO [launcher]: Starting browser Chrome
DEBUG [temp-dir]: Creating temp dir at /var/folders/dw/qt56vk_s4cz5h6hg8qddvmrm0000gn/T/karma-24748311
DEBUG [launcher]: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --user-data-dir=/var/folders/dw/qt56vk_s4cz5h6hg8qddvmrm0000gn/T/karma-24748311 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate http://localhost:8080/?id=24748311
WARN [watcher]: Pattern "/Work/[lab]/angularjs-up-and-running/chapter3/node_modules/karma-jasmine/lib/jasmine.js" does not match any file.
WARN [watcher]: Pattern "/Work/[lab]/angularjs-up-and-running/chapter3/angular-mocks.js" does not match any file.
WARN [watcher]: Pattern "/Work/[lab]/angularjs-up-and-running/chapter3/node_modules/karma-jasmine/lib/adapter.js" does not match any file.
WARN [watcher]: Pattern "/Work/[lab]/angularjs-up-and-running/chapter3/angular.min.js" does not match any file.
WARN [watcher]: Pattern "/Work/[lab]/angularjs-up-and-running/chapter3/simpleSpec.js" does not match any file.
WARN [watcher]: Pattern "/Work/[lab]/angularjs-up-and-running/chapter3/controller.js" does not match any file.
WARN [watcher]: Pattern "/Work/[lab]/angularjs-up-and-running/chapter3/controllerSpec.js" does not match any file.
DEBUG [watcher]: Resolved files:

DEBUG [watcher]: Watching "/Work/[lab]/angularjs-up-and-running/chapter3/angular.min.js"
DEBUG [watcher]: Watching "/Work/[lab]/angularjs-up-and-running/chapter3/angular-mocks.js"
DEBUG [watcher]: Watching "/Work/[lab]/angularjs-up-and-running/chapter3/controller.js"
DEBUG [watcher]: Watching "/Work/[lab]/angularjs-up-and-running/chapter3/simpleSpec.js"
DEBUG [watcher]: Watching "/Work/[lab]/angularjs-up-and-running/chapter3/controllerSpec.js"
DEBUG [web-server]: serving: /Work/[lab]/angularjs-up-and-running/chapter3/node_modules/karma/static/client.html
DEBUG [web-server]: serving: /Work/[lab]/angularjs-up-and-running/chapter3/node_modules/karma/static/karma.js
DEBUG [web-server]: upgrade /socket.io/1/websocket/YVK_k4vczJIuLIdg5a_f
DEBUG [karma]: A browser has connected on socket YVK_k4vczJIuLIdg5a_f
INFO [Chrome 38.0.2125 (Mac OS X 10.10.0)]: Connected on socket YVK_k4vczJIuLIdg5a_f with id 24748311
DEBUG [launcher]: Chrome (id 24748311) captured in 5.575 secs
DEBUG [karma]: All browsers are ready, executing
DEBUG [web-server]: serving: /Work/[lab]/angularjs-up-and-running/chapter3/node_modules/karma/static/context.html
Chrome 38.0.2125 (Mac OS X 10.10.0) ERROR
  You need to include some adapter that implements __karma__.start method!

所以首先它有警告查找文件,但所有这些文件在该位置确实存在。

So first of all it has warnings finding files, however all of those files do exist at that location.

我karma.conf.js文件看起来像这样:

My karma.conf.js file looks like this:

module.exports = function(config) {
  config.set({
    // base path, that will be used to resolve files and exclude
    basePath: '',

    // testing framework to use (jasmine/mocha/qunit/...)
    frameworks: ['jasmine'],

    // list of files / patterns to load in the browser
    files: [
      'angular.min.js',
      'angular-mocks.js',
      'controller.js',
      'simpleSpec.js',
      'controllerSpec.js'
    ],

    // list of files / patterns to exclude
    exclude: [],

    // web server port
    port: 8080,

    // level of logging
    // possible values: LOG_DISABLE || LOG_ERROR ||
    //                  LOG_WARN || LOG_INFO || LOG_DEBUG
    logLevel: config.LOG_DEBUG,


    // enable / disable watching file and executing tests
    // whenever any file changes
    autoWatch: true,

    // Start these browsers, currently available:
    // - Chrome
    // - ChromeCanary
    // - Firefox
    // - Opera
    // - Safari (only Mac)
    // - PhantomJS
    // - IE (only Windows)
    browsers: ['Chrome'],


    // Continuous Integration mode
    // if true, it capture browsers, run tests and exit
    singleRun: false
  });
};

业力被安装在我的项目文件夹(其中karma.conf.js所在地)

karma is installed in my project folder (where karma.conf.js is located)

我真的不知道什么是错的,我看不到的方式来接触这本书的作者。谢谢!

I really have no idea what's wrong and I can't see a way to contact the author of this book. Thanks!

推荐答案

我面临着同样的问题,我的心快要爆炸了。我找不到任何地方任何东西,所有的配置都是确定,似乎没有什么错。你的问题是我能找到的最接近。

I was facing that same issue and my mind was about to explode. I couldn't find anything anywhere, all the configurations were ok and nothing seemed wrong. Your question was the closest thing I could find.

我意识到,这两个,你的项目文件路径和矿山包含方括号(... / [实验室] / ...在你),它可能是原因。众所周知,特殊caracters有时是麻烦的。

I realized that both, your project filepath and mine contained square braces (.../[lab]/... in yours) and that it might be the cause. It is known that special caracters sometimes are troublesome.

我删除了我的文件路径中括号和所有的测试完美。

I deleted the square braces from my filepath and all the tests worked perfectly.

如果你留意调试线,jasmine.js和adapter.js没有得到解决。

If you pay attention to the Debug lines, jasmine.js and adapter.js were not resolved.

我希望这会有所帮助。

 
精彩推荐