define(["require","exports","./util","intern/dojo/errors/CancelError","intern/dojo/node!http","intern/dojo/node!url","intern/dojo/node!querystring","intern/dojo/node!glob","intern/dojo/node!http-proxy","intern/dojo/node!jsgi-node","intern/dojo/node!jsgi-node/jsgi/node","intern/dojo/node!formidable"],function(r,e,o,s,i,a,d,t,n,f,u,c){var l,h=u.Node,p=new n.RoutingProxy;function m(t){var r=/^multipart\/form-data;/;return function(e){var n=e.headers;return n["content-type"]&&r.test(n["content-type"])&&(e.data=new o.Promise(function(o,i){h(function(e){(new c.IncomingForm).parse(e,function(e,n,t){for(var r in e&&i(e),t)n[r]=t[r];o(n)})})(e)})),t(e)}}l=r,r=function(e){return new o.Promise(function(n){l([e],function(e){n(e)})})},e.start=function(n){return o.call(t,"**/*.service.js",{cwd:"./tests/services"}).then(function(e){return o.map(e,function(t){return r("./"+t.slice(0,-3)).then(function(e){var n=t.slice(0,-11);return{regexp:new RegExp("^/"+n.replace(/\//g,"\\/")+"(\\/.*)?$"),module:e}})})}).then(function(u){var c=/^\/__services(\/.*)$/,t=new f.Listener(new m(function(t){var r,e=a.parse(t.pathInfo,!0),n=d.parse(t.queryString),o=e.pathname.match(c),i=o&&o[1];return i&&(t.urlInfo=e,t.query=n,t.serviceURL=i,u.some(function(e){var n=i.match(e.regexp);if(n)return t.urlInfo.pathname=n[1],r=e.module.call(null,t),!0})),r?"function"==typeof r.then?r.then(function(e){return e},function(e){if(e instanceof s)return{body:[""]};throw e}):r:{status:500,headers:{"Content-Type":"text/html;charset=utf-8"},body:["