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
You need to run your karma run
or whatever function in the folder where karma-conf.js is in.
In my case, I was applying by mistake the commonjs preprocessor to the karma-*
modules and the adapter.js
from karma-chrome
and karma-firefox
was broken this way.
Unfortunately, this is a very generic error.
You need to configure your "my.conf.js" file, because it contains all the info to use to test your code.
All what you need to write is this:
The configuration file can be generated using karma init:
$ karma init my.conf.js
Which testing framework do you want to use? Press tab to list possible options. Enter to move to the next question.
jasmine
Do you want to use Require.js? This will add Require.js plugin. Press tab to list possible options. Enter to move to the next question.
no
Do you want to capture a browser automatically? Press tab to list possible options. Enter empty string to move to the next question.
Chrome
What is the location of your source and test files? You can use glob patterns, eg. "js/*.js" or "test/**/*Spec.js". Press Enter to move to the next question.
*.js test/**/*.js
Should any of the files included by the previous patterns be excluded? You can use glob patterns, eg. "**/*.swp".
Press Enter to move to the next question.
Do you want Karma to watch all the files and run the tests on change? Press tab to list possible options.
yes
Config file generated at "/Users/vojta/Code/karma/my.conf.js".
You will have to specify the directory of karma.config.js
when you run start karma.
Try
karma start karma.config.js
I was not running karma start command from the path where my karma.conf.js was. I switched to that folder and ran the same command. Thats all
I've been struggling with this too. What I came up to is that this error occurs because one of the following reasons
karma.conf.js
in current dir or no config file specified in command)My problem was that my config file was named karma.config.js
instead of karma.conf.js
.
If you've installed the test adapter but it still doesn't work, try running karma init
and go through the guided config setup.