Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test_runner.js

Issue 29354864: Issue 4223 - Migrate some more of adblockplustests (Closed)
Patch Set: Moved test/stub-modules/common.js to test/common.js Created Oct. 3, 2016, 4:39 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/subscriptionClasses.js ('k') | test_wrapper.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..1d0a4e73b88843df1d34c9859688f83c9459fb00 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 (testPath.endsWith(".js") && 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);
« no previous file with comments | « test/subscriptionClasses.js ('k') | test_wrapper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld