Repository navigation
Expand file tree
/
Copy pathrunner
More file actions
executable file
·116 lines (98 loc) · 2.52 KB
/
Copy pathrunner
File metadata and controls
executable file
·116 lines (98 loc) · 2.52 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
C2F3
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
#!/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 = [
"level1/core.js",
"level1/html.js",
"level2/core.js",
"level2/html.js",
"level2/style.js",
"level2/extra.js",
"level2/events.js",
//"level3/core.js",
//"level3/ls.js",
"level3/textContent.js",
"level3/xpath.js",
"living-dom/attributes.js",
"living-dom/compare-document-position.js",
"living-dom/node-contains.js",
"living-dom/node-parent-element.js",
"living-dom/query-selector.js",
"living-dom/query-selector-all.js",
"living-html/focus.js",
"living-html/htmlinputelement.js",
"living-html/htmloptionelement.js",
"living-html/htmltextareaelement.js",
"living-html/htmlformelement.js",
"living-html/location.js",
"living-html/htmlimageelement.js",
"living-html/navigator.js",
"window/history.js",
"window/script.js",
"window/console.js",
"window/frame.js",
"sizzle/index.js",
"jsdom/index.js",
"jsdom/parsing.js",
"jsdom/env.js",
"jsdom/utils.js",
"jsdom/namespaces.js",
"jsdom/virtual-console.js",
"jsdom/xml.js",
"jsdom/selectors.js",
"jsonp/jsonp.js",
"browser/css.js",
"browser/index.js",
"w3c/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;
}
});
var reporter = argv.verbose ? nodeunit.reporters.default : nodeunit.reporters.minimal;
reporter.run(modulesToRun, null, function(err) {
process.exit(err ? 1 : 0);
});