mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-02-01 03:12:42 +01:00
wrap spec files with a describe
This commit is contained in:
parent
cac27c864a
commit
9537892c61
1 changed files with 19 additions and 2 deletions
|
@ -10,8 +10,8 @@ exports.expressCreateServer = function (hook_name, args, cb) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
args.app.get('/tests/frontend/*', function (req, res) {
|
var url2FilePath = function(url){
|
||||||
var subPath = req.url.substr("/tests/frontend".length);
|
var subPath = url.substr("/tests/frontend".length);
|
||||||
if (subPath == ""){
|
if (subPath == ""){
|
||||||
subPath = "index.html"
|
subPath = "index.html"
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,24 @@ exports.expressCreateServer = function (hook_name, args, cb) {
|
||||||
|
|
||||||
var filePath = path.normalize(__dirname + "/../../../../tests/frontend/")
|
var filePath = path.normalize(__dirname + "/../../../../tests/frontend/")
|
||||||
filePath += subPath.replace("..", "");
|
filePath += subPath.replace("..", "");
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
args.app.get('/tests/frontend/specs/*', function (req, res) {
|
||||||
|
var specFilePath = url2FilePath(req.url);
|
||||||
|
var specFileName = path.basename(specFilePath);
|
||||||
|
|
||||||
|
fs.readFile(specFilePath, function(err, content){
|
||||||
|
if(err){ return res.send(500); }
|
||||||
|
|
||||||
|
content = "describe(" + JSON.stringify(specFileName) + ", function(){ " + content + " });";
|
||||||
|
|
||||||
|
res.send(content);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
args.app.get('/tests/frontend/*', function (req, res) {
|
||||||
|
var filePath = url2FilePath(req.url);
|
||||||
res.sendfile(filePath);
|
res.sendfile(filePath);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue