airportyh/testem — pull request #329 by phtrivier (2013-12-17 17:03:17+00:00)
Title: Attemps to add support for multi-folder routes

Hi

I'm trying to test pages that use requirejs. For some reason, in
development mode, all my static js client-side files are not under
the same folder hierarchy ; however I want to serve both hierarchy
under the same prefix.

For example, If I have :

+ root
+ public
+ js
+ foo.js
+ deps
+ commons
+ js
+ bar.js

I want to be able to serve :

* File /root/public/js/foo.js as URL '/public/js/foo.js'
* File /root/deps/commonsjs/bar.js as URL '/public/js/bar.js'

I though using 'routes' would do the trick, but unfortunately you can
only use one path.

So I tried to allow specifying routes like this :

{
routes : {
'public' : ['public', "deps/commons"]
}
}

The idea being that if a url matches a route, the first file that can
be located in any of the folders passed in the list is returned.

I managed to implement something, but unfortunately, serving the files
becomes incredibly slow with this ; so there must be something very
inefficient somewhere, that I can not find.

I added a server tests, everything passes fine (I had to uncomment the
other 'routes' tests, though.)

So this PR is more about asking for help than anything :)

* is there a built-in way to deal with my case ?
* do you have any idea why my patch makes thing so slow ?

Thanks !