allow filtering tests in browser runner

This commit is contained in:
nightwing 2014-12-13 16:45:56 +04:00
commit c5edaa3608

View file

@ -72,6 +72,8 @@ document.body.appendChild(nav);
if (location.search)
testNames = location.search.substr(1).split(",")
var filter = location.hash.substr(1);
require(testNames, function() {
var tests = testNames.map(function(x) {
var module = require(x);
@ -81,6 +83,12 @@ require(testNames, function() {
async.list(tests)
.expand(function(test) {
if (filter) {
Object.keys(test).forEach(function(method) {
if (method.match(/^>?test/) && !method.match(filter))
test[method] = undefined;
});
}
return AsyncTest.testcase(test)
}, AsyncTest.TestGenerator)
.run()