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

Unified Diff: test_runner.js

Issue 29860555: Issue 6717 - Part 2: run qunit in headless firefox (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/file/3270e924ba9f
Patch Set: Created Aug. 21, 2018, 10:57 a.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
« package.json ('K') | « test/firefox.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test_runner.js
diff --git a/test_runner.js b/test_runner.js
new file mode 100644
index 0000000000000000000000000000000000000000..5e3a944bf0f1fe4b77ab26468d6730d6aafea655
--- /dev/null
+++ b/test_runner.js
@@ -0,0 +1,62 @@
+/*
+ * This file is part of Adblock Plus <https://adblockplus.org/>,
+ * Copyright (C) 2006-present eyeo GmbH
+ *
+ * Adblock Plus is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3 as
+ * published by the Free Software Foundation.
+ *
+ * Adblock Plus is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+"use strict";
+
+const nodeunit = require("nodeunit");
+const path = require("path");
+const fs = require("fs");
+
+let unitFiles = [];
+
+function addTestPaths(testPaths, recurse)
+{
+ for (let testPath of testPaths)
+ {
+ let stat = fs.statSync(testPath);
+ if (stat.isDirectory())
+ {
+ if (recurse)
+ {
+ addTestPaths(fs.readdirSync(testPath).map(
+ file => path.join(testPath, file)));
+ }
+ continue;
+ }
+ if (path.basename(testPath).startsWith("_"))
+ continue;
+ if (path.extname(testPath) == ".js")
+ {
+ unitFiles.push(testPath);
+ }
+ }
+}
+
+if (process.argv.length > 2)
+ addTestPaths(process.argv.slice(2), true);
+else
+{
+ addTestPaths(
+ [path.join(__dirname, "test")],
+ true
+ );
+}
+
+if (unitFiles.length)
+{
+ nodeunit.reporters.default.run(unitFiles);
+}
« package.json ('K') | « test/firefox.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld