aboutsummaryrefslogtreecommitdiff
path: root/node_modules/domutils/tests/00-runtests.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
committerFlorian Dold <florian.dold@gmail.com>2019-03-27 21:01:33 +0100
commitcc97a4dd2a967e1c2273bd5f4c5f49a5bf2e2585 (patch)
tree92c5d88706a6ffc654d1b133618d357890e7096b /node_modules/domutils/tests/00-runtests.js
parent3771b4d6b67b34c130f3a9a1a15f42deefdb2eda (diff)
remove node_modules
Diffstat (limited to 'node_modules/domutils/tests/00-runtests.js')
-rw-r--r--node_modules/domutils/tests/00-runtests.js64
1 files changed, 0 insertions, 64 deletions
diff --git a/node_modules/domutils/tests/00-runtests.js b/node_modules/domutils/tests/00-runtests.js
deleted file mode 100644
index cf7a3b7f8..000000000
--- a/node_modules/domutils/tests/00-runtests.js
+++ /dev/null
@@ -1,64 +0,0 @@
-var fs = require("fs"),
- assert = require("assert");
-
-var runCount = 0,
- testCount = 0;
-
-function compare(expected, result){
- if(typeof expected !== typeof result){
- throw Error("types didn't match");
- }
- if(typeof expected !== "object" || expected === null){
- if(expected !== result){
- throw Error("result doesn't equal expected");
- }
- return;
- }
-
- for(var prop in expected){
- if(!(prop in result)) throw Error("result didn't contain property " + prop);
- compare(expected[prop], result[prop]);
- }
-}
-
-function runTests(test){
- //read files, load them, run them
- fs.readdirSync(__dirname + test.dir
- ).map(function(file){
- if(file[0] === ".") return false;
- if(file.substr(-5) === ".json") return JSON.parse(
- fs.readFileSync(__dirname + test.dir + file)
- );
- return require(__dirname + test.dir + file);
- }).forEach(function(file){
- if(!file) return;
- var second = false;
-
- runCount++;
-
- console.log("Testing:", file.name);
-
- test.test(file, function(err, dom){
- assert.ifError(err);
- compare(file.expected, dom);
-
- if(second){
- runCount--;
- testCount++;
- }
- else second = true;
- });
- });
- console.log("->", test.dir.slice(1, -1), "started");
-}
-
-//run all tests
-[
- "./02-dom_utils.js"
-].map(require).forEach(runTests);
-
-//log the results
-(function check(){
- if(runCount !== 0) return process.nextTick(check);
- console.log("Total tests:", testCount);
-}()); \ No newline at end of file