Copying references from index.html into karma.conf.js automatically

I'm trying to generate a karma.conf.js for my testing.

My app has already aout 30 tags in it referencing my code. I'm writing my AngularJS code in a modulized structure, like it is recommended here.

I wonder how to not write all the refereneces into the karma.conf.js again.. Does anybody know a solution for this?

I looked at https://preview.npmjs.com/package/karma-loadscripts-preprocessor but it didn't do the job. Seems to be for loading external scripts from cdn-sources.

I'm a bit stuck and right before writing my own shell script wich does the job for me.

In my experience this is not a big problem in angular projects. The included files do not change too often and they are manually manageable. It also happens sometimes to have different includes in the Karma file, because you may want to mock some modules.

If you are really committed to be dry on this, and you are using the angular generator in Yeoman, a solution could be to include the built version of your app in Karma

In your karma.conf.js file you can reference multiple files in a directory or in subdirectories. For the files property in your karma.conf you can do similar to below.

files: [
  'www/js/*.js',
  'www/**/*.js'
]

The first show will get all in the in the js folder. However the second will get you all the javascript files in the www/ folder and subfolders including the js/ folder.

Hope this helps.