Reputation: 579
I'm following John Papa's Style Guide and am having problems getting all of my Jasmine specs to load after everything else. The problem is that the directory structure of my app is flat, and thus the spec files are included in the same directory as the files they are testing.
files: [
'app/vendor/js/jquery.js',
'app/vendor/js/angular.js',
'app/vendor/js/*.js',
'bower_components/angular-mocks/angular-mocks.js',
'app/app.js',
'app/app.constants.js',
'app/app.config.js',
'app/**/*.app.js',
'app/**/*.js',
'app/**/*.spec.js',
'app/**/*.html'
]
The other problem is that in the Karma configuration file, it's including all of the .spec.js
files in with the plain old .js
files. So the second to last string in the above array is redundant, but it's there to illustrate what I am trying to do.
How do I get my spec files to load after all of the other JavaScript files?
EDIT: By following JP's style guide, your files should be named with a chaining syntax: the.directive.js
, the.directive.spec.js
. So, you can solve my problem by just including all all directives (.directive.js
), controllers (.controller.js
), etc. before the specs instead of using the universal .js
. However, I want to see if someone comes up with a more robust solution.
Upvotes: 1
Views: 547
Reputation: 1644
Try with
files: [
'app/**/!(*spec).js',
'app/**/*spec.js',
...
]
Upvotes: 3