Karma configuration file - using basePath

I just tried some things in my Karma configuration file and had an array of files, for example:

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 that I could use basePath here, for example. basePath: "../dist/" in the config, and this will eliminate the need to add "../dist/" on some of these paths. But in the case of my test folder located at the same level as dist, how would I go up to the level?

Would that be so?

 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 very stupid question, but I just wanted to be sure!

+6
source share
1 answer

That should be right. You can specify a relative path to navigate to one or more directories.

From the documentation:

The location of the root path that will be used to resolve all relative paths defined in the files and exclude. If the underlying configuration is a relative path, then it will be allowed for the __dirname of the configuration file.

This is one of those things that you can just try and see if it works.

+4
source

Source: https://habr.com/ru/post/989687/


All Articles