Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
-2
rated 0 times [  3] [ 5]  / answers: 1 / hits: 29530  / 9 Years ago, sat, february 21, 2015, 12:00:00

I have a simple AngularJs application setup, that looks a bit like this:



client
vendor
angular
bootstrap
jquery
...
app.module.js
app.controller.js
...
node_modules
angular-mocks
...


I'm setting up a karma.conf.js file and I want to include angularangular.js from vendor. I don't want to include anything else from vendor.



Here is what I have in the relevant karma.conf.js sections:



files: [
'client/vendor/angular/angular.js',
'client/**/*.js',
'client/**/*.spec.js'
],
exclude: [
'client/vendor/**/*.js'
],


The problem I have is simple: I'm including angular.js explicitly in files, but it is then being excluded in the exclude section pattern.



How can I exclude all of client/vendor except for angular/angular.js (and perhaps others later)? The client directory contains a lot of files, sub-folders, etc, that include my own .js files, so it's not easy to just move everything I want to include into a folder of its own, for example.


More From » angularjs

 Answers
24

Try this:



client/vendor/**/!(angular).js


Example



More filenames can be excluded like this:



client/vendor/**/!(angular|angular-route).js


The patterns used here are called globs.



Here is a short guide to glob functionality in node from node-globs on GH.


[#67721] Friday, February 20, 2015, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lucianom

Total Points: 601
Total Questions: 98
Total Answers: 109

Location: Kenya
Member since Fri, Dec 23, 2022
1 Year ago
lucianom questions
Tue, Feb 22, 22, 00:00, 2 Years ago
Wed, May 5, 21, 00:00, 3 Years ago
Sun, Jan 24, 21, 00:00, 3 Years ago
Sat, Aug 15, 20, 00:00, 4 Years ago
Mon, Jun 22, 20, 00:00, 4 Years ago
;