Repository navigation
Expand file tree
/
Copy pathrunner
More file actions
executable file
·119 lines (100 loc) · 2.92 KB
/
Copy pathrunner
File metadata and controls
executable file
·119 lines (100 loc) · 2.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#!/usr/bin/env node
var nodeunit = require('nodeunit'),
path = require('path');
var argv = require('./runner-options').argv;
if (argv.help) {
require('optimist').showHelp();
process.exit();
}
var fileFilter = [];
var testFilter = [];
Error.stackTraceLimit = 100;
if (argv.suites) {
fileFilter = argv.suites.replace(/\s/g, '').split(',');
}
if (argv.tests) {
testFilter = argv.tests.replace(/\s/g, '').split(',');
}
var files = [
"level2/core.js",
"level2/html.js",
"level2/style.js",
"level2/events.js",
//"level3/core.js",
//"level3/ls.js",
"level3/textContent.js",
"level3/xpath.js",
"living-dom/class-list.js",
"living-dom/compare-document-position.js",
"living-dom/dom-implementation.js",
"living-dom/event-target.js",
"living-dom/node-clone-node.js",
"living-dom/node-contains.js",
"living-dom/node-owner-document.js",
"living-dom/node-parent-element.js",
"living-dom/query-selector.js",
"living-dom/query-selector-all.js",
"living-dom/node-iterator.js",
"living-dom/parent-node.js",
"living-dom/non-document-type-child-node.js",
"living-html/current-script.js",
"living-html/htmlanchorelement.js",
"living-html/htmlelement.js",
"living-html/htmlcanvaselement.js",
"living-html/htmlimageelement.js",
"living-html/htmlinputelement.js",
"living-html/inline-event-handlers.js",
"living-html/location.js",
"living-html/message-event.js",
"living-html/on-error.js",
"living-html/post-message.js",
"misc/xhr-file-urls.js",
"misc/xhr-requires-server.js",
"window/history.js",
"window/script.js",
"window/frame.js",
"sizzle/index.js"
];
if (fileFilter.length > 0) {
files = files.filter(function(val) {
var ok = false;
fileFilter.forEach(function(v) {
if (val.indexOf(v) > -1) {
ok = true;
}
});
return ok;
});
}
var modules = {};
var modulesToRun = {};
files.map(function (p) {
var required = require(path.join(__dirname, p));
var module = required.tests || required;
var filteredModule = {};
if (testFilter.length) {
var moduleKeys = Object.keys(module);
testFilter.forEach(function(filter) {
filter = filter.toLowerCase();
moduleKeys.forEach(function(moduleKey) {
if (moduleKey.toLowerCase().indexOf(filter) > -1) {
filteredModule[moduleKey] = module[moduleKey];
}
});
});
module = filteredModule;
}
if (module && Object.keys(module).length > 0) {
modulesToRun[p] = module;
}
});
// Make sure that any Error that occurs in a callback is logged.
// This should not be something we would have to do manually, the test library should handle it...
process.on("uncaughtException", function (err) {
console.error("Uncaught exception: ", err, err.stack);
process.exit(1); // Uncaught Fatal Exception
});
var reporter = argv.verbose ? nodeunit.reporters.default : nodeunit.reporters.minimal;
reporter.run(modulesToRun, null, function(err) {
process.exit(err ? 1 : 0);
});