Error: You need to include some adapter that implements __karma__.start method

后端 未结 26 1340
梦谈多话
梦谈多话 2020-12-01 11:53

I\'m trying to add some unit tests to one of my projects.

So far I\'ve installed and configured karma, and have installed jasmine. I\'ve one test file in my te

相关标签:
26条回答
  • 2020-12-01 12:01

    In my case I had to rename the file to karma.conf.js then do karma start

    0 讨论(0)
  • 2020-12-01 12:02

    Same issue happened to me, and it was due to an outdated module.

    Running npm update solved it.

    0 讨论(0)
  • 2020-12-01 12:03

    Tt's complaining about the adapter which is probably jasmine or mocha. Either the adapter is missing, either is not setup correctly, either it's an outdated or buggy version of the adapter.

    In my case I had an old version of mocha 2.5.3 which was not compatible with karma 1+. I updated the mocha dependency to the latest version available 3.2.0 and the problem solved.

    0 讨论(0)
  • 2020-12-01 12:03

    I had a bad 'files' configuration in my karma.conf.js

    files: ['**/*.js'],
    

    this caught up all the files in node_modules/ including those of the karma-jasmine plugin, as it was seen as sourde files it wasn't loaded on startup. Changing to

    files: [
            'src/*.js',
            'spec/*.js'
        ],
    

    solved the problem in my case

    0 讨论(0)
  • 2020-12-01 12:05

    If you name your karma config file karma.conf.js, you can simply type karma start.

    Otherwise specify the filename karma start karmafile.js

    (I was in the right directory, but was not specifying a file name.)

    0 讨论(0)
  • 2020-12-01 12:06

    It does seem like this is a very general error, however in my case the problem was either that I didn't run karma start from the correct folder, or that I didn't restart it after changing the configuration.

    I'll leave this question open and hopefully it can become a resource for others who experience this error message.

    0 讨论(0)
提交回复
热议问题