Index: test_runner.js |
diff --git a/lib/coreUtils.js b/test_runner.js |
similarity index 51% |
copy from lib/coreUtils.js |
copy to test_runner.js |
index b9e9a2f050252ae0ac6d4d7d1a1919ff812c1d7a..be6399a6d107b97d74db0b4832abc16e85a56e32 100644 |
--- a/lib/coreUtils.js |
+++ b/test_runner.js |
@@ -15,20 +15,30 @@ |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
-function desc(properties) |
-{ |
- let descriptor = {}; |
- let keys = Object.keys(properties); |
+"use strict"; |
- for (let key of keys) |
- descriptor[key] = Object.getOwnPropertyDescriptor(properties, key); |
+let fs = require("fs"); |
+let path = require("path"); |
+let process = require("process"); |
+let nodeunit = require("nodeunit"); |
- return descriptor; |
-} |
-exports.desc = desc; |
+let files = []; |
-function extend(cls, properties) |
+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) && testPath != "test/common.js") |
+ files.push(testPath); |
+ } |
} |
-exports.extend = extend; |
+ |
+addTestPaths(process.argv.length > 2 ? process.argv.slice(2) : ["test"], 2); |
+nodeunit.reporters.default.run(files); |