From 594d27233449979ff0e4107e1e3a312cc1c3f9e7 Mon Sep 17 00:00:00 2001 From: John McLear Date: Sun, 3 Feb 2013 00:14:17 +0000 Subject: [PATCH] allow plugins to specify frontend test specs --- src/node/hooks/express/tests.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/node/hooks/express/tests.js b/src/node/hooks/express/tests.js index 94cd5fb6..50fef800 100644 --- a/src/node/hooks/express/tests.js +++ b/src/node/hooks/express/tests.js @@ -5,6 +5,17 @@ var path = require("path") 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){ + + fs.readdir('node_modules', function(err, plugins){ // installed plugins + plugins.forEach(function(plugin){ // for each one + if(fs.existsSync("node_modules/"+plugin+"/tests/frontend/specs")){ // If the folder exists + fs.readdir("node_modules/"+plugin+"/tests/frontend/specs/", function(err, pluginFiles){ + files.push(pluginFiles); + }); + } + }); + }); + if(err){ return res.send(500); } res.send("var specs_list = " + JSON.stringify(files.sort()) + ";\n"); @@ -44,4 +55,4 @@ 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 +}