Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I list the routes to all files being served by karma

I'm using requirejs inside of karma to run my tests, but I'm having trouble figuring out what the actual urls to my files are.

Is there any way to list the files being served and the routes to access them?

like image 882
lostinplace Avatar asked May 13 '14 18:05

lostinplace


1 Answers

You can access object window.__karma__ which has property files. You can iterate over it.

I just entered this code into my test-main.js:

for (var file in window.__karma__.files) {
  console.log(file)
}

All served files would be printed to console among other messages. Here is sample from my output:

...
Firefox 32.0.0 (Ubuntu) LOG: '/base/node_modules/requirejs/require.js'
Firefox 32.0.0 (Ubuntu) LOG: '/base/node_modules/karma-requirejs/lib/adapter.js'
Firefox 32.0.0 (Ubuntu) LOG: '/base/node_modules/karma-jasmine/lib/jasmine.js'
...
like image 179
Towel Avatar answered Nov 02 '22 02:11

Towel