From cac27c864a394ba7a6ce0cf6bf1e3f625c6a3d49 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Sat, 27 Oct 2012 17:05:26 +0100 Subject: load list of spec files from the server --- src/node/hooks/express/tests.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/node/hooks/express') diff --git a/src/node/hooks/express/tests.js b/src/node/hooks/express/tests.js index ebc6d7f8..793fcfd8 100644 --- a/src/node/hooks/express/tests.js +++ b/src/node/hooks/express/tests.js @@ -1,6 +1,15 @@ var path = require("path"); +var fs = require("fs"); exports.expressCreateServer = function (hook_name, args, cb) { + args.app.get('/tests/frontend/specs_list.js', function(req, res){ + fs.readdir('tests/frontend/specs', function(err, files){ + if(err){ return res.send(500); } + + res.send("var specs_list = " + JSON.stringify(files.sort()) + ";\n"); + }); + }); + args.app.get('/tests/frontend/*', function (req, res) { var subPath = req.url.substr("/tests/frontend".length); if (subPath == ""){ @@ -16,5 +25,5 @@ exports.expressCreateServer = function (hook_name, args, cb) { args.app.get('/tests/frontend', function (req, res) { res.redirect('/tests/frontend/'); - }); + }); } \ No newline at end of file -- cgit v1.2.3