| Index: test_runner.js |
| diff --git a/lib/coreUtils.js b/test_runner.js |
| similarity index 50% |
| copy from lib/coreUtils.js |
| copy to test_runner.js |
| index b9e9a2f050252ae0ac6d4d7d1a1919ff812c1d7a..3d1455d50cbd3d6ed612cc9c1610e6602b3ac0e7 100644 |
| --- a/lib/coreUtils.js |
| +++ b/test_runner.js |
| @@ -15,20 +15,29 @@ |
| * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| */ |
| -function desc(properties) |
| -{ |
| - let descriptor = {}; |
| - let keys = Object.keys(properties); |
| - |
| - for (let key of keys) |
| - descriptor[key] = Object.getOwnPropertyDescriptor(properties, key); |
| +"use strict"; |
| - return descriptor; |
| -} |
| -exports.desc = desc; |
| +let fs = require("fs"); |
| +let path = require("path"); |
| +let process = require("process"); |
| +let nodeunit = require("nodeunit"); |
| -function extend(cls, properties) |
| +let files = []; |
| +function addTestPaths(testPaths, depth) |
| { |
| - return Object.create(cls.prototype, desc(properties)); |
| + if (depth < 1) |
| + return; |
| + |
| + for (let testPath of testPaths) |
| + { |
| + let stat = fs.statSync(testPath); |
| + if (stat.isDirectory()) |
| + addTestPaths(fs.readdirSync(testPath).map(file => path.join(testPath, file)), |
| + depth -1); |
| + else if (path.extname(testPath) && path.basename(testPath) != "common.js") |
| + files.push(testPath); |
| + } |
| } |
| -exports.extend = extend; |
| +addTestPaths(process.argv.length > 2 ? process.argv.slice(2) : [path.join(__dirname, "test")], 2); |
| + |
| +nodeunit.reporters.default.run(files); |