I am just trying out some things in my Karma config file, and have a files array set like so:
files: [
'../dist/app/**/*.mock.js',
'../dist/assets/scripts/bower_libs.js',
'../dist/assets/scripts/main.js',
'../test/src/**/*.js',
'../dist/app/**/*.spec.js'
],
I know I could use a basePath here, e.g. basePath: '../dist/' in the config, and that would remove the need to prepend '../dist/' on some of those paths. But in the case of my test folder located at the same level as dist, how would I go up a level?
Would it be this kind of thing?
basePath: '../dist/'
files: [
'app/**/*.mock.js',
'assets/scripts/bower_libs.js',
'assets/scripts/main.js',
'../test/src/**/*.js',
'app/**/*.spec.js'
],
This is probably a really dumb question, but I just wanted to be sure!
Overview. In order to serve you well, Karma needs to know about your project in order to test it and this is done via a configuration file. The easiest way to generate an initial configuration file is by using the karma init command. This page lists all of the available configuration options.
The karma. conf. js file is a partial Karma configuration file. The CLI constructs the full runtime configuration in memory, based on application structure specified in the angular. json file, supplemented by karma.
The property singleRun controls how Karma executes, if set to true , Karma will start, launch configured browsers, run tests and then exit with a code of either 0 or 1 depending on whether or not all tests passed.
If you want to disable the Karma Test Adapter completely then use @nihique answer. However, if you still want to use Karma for your tests but do not want it to run automatically then add/update these settings in Karma's configuration file, specifically autoWatch .
That should be correct. You can specify a relative path to go up one or more directories.
From the documentation:
The root path location that will be used to resolve all relative paths defined in files and exclude. If the basePath configuration is a relative path then it will be resolved to the __dirname of the configuration file.
This is one of those things that you can just try out and see if it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With