Skip to content

Commit aa42e9f

Browse files
committed
Fix testing.
1 parent ae2095d commit aa42e9f

2 files changed

Lines changed: 46 additions & 52 deletions

File tree

index.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14864,12 +14864,6 @@ process.on('uncaughtException', function(e) {
1486414864
return;
1486514865
}
1486614866

14867-
if (F.isTest) {
14868-
// HACK: this method is created dynamically in F.testing();
14869-
F.testContinue && F.testContinue(e);
14870-
return;
14871-
}
14872-
1487314867
F.error(e, '', null);
1487414868
});
1487514869

test.js

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,52 @@ T.results = [];
88
T.running = false;
99
T.immediate = null;
1010

11+
function NEXT() {
12+
13+
T.immediate && clearImmediate(T.immediate);
14+
T.immediate = null;
15+
16+
var fn = T.current ? T.current.items.shift() : null;
17+
18+
if (fn != null) {
19+
fn();
20+
return;
21+
}
22+
23+
if (T.current) {
24+
T.results.push(T.current);
25+
console.log('');
26+
}
27+
28+
var test = F.tests.tests.shift();
29+
if (test == null) {
30+
31+
console.log('===================== RESULTS ======================');
32+
console.log('');
33+
console.log('> Passed .........', T.countok + '/' + T.count);
34+
console.log('> Failed ' + (T.countno ? '[x] .....' : '.........'), T.countno + '/' + T.count);
35+
console.log('');
36+
37+
F.isTest = false;
38+
F.emit('test-end', T);
39+
40+
// DONE
41+
setTimeout(function() {
42+
F.kill(T.countno ? 1 : 0);
43+
}, 1000);
44+
45+
} else {
46+
47+
T.current = test;
48+
T.current.results = [];
49+
50+
console.log('[ TEST: ' + test.filename.substring(F.path.root('/tests/').length) + (T.current.priority ? ' ({0}) ]'.format(T.current.priority) : ' ]'));
51+
console.log('');
52+
53+
NEXT();
54+
}
55+
}
56+
1157
global.TEST = function(name, url, scope) {
1258

1359
if (typeof(url) === 'function') {
@@ -59,52 +105,6 @@ global.OK = function(is, description) {
59105
T.immediate = setImmediate(NEXT);
60106
};
61107

62-
global.NEXT = function() {
63-
64-
T.immediate && clearImmediate(T.immediate);
65-
T.immediate = null;
66-
67-
var fn = T.current ? T.current.items.shift() : null;
68-
69-
if (fn != null) {
70-
fn();
71-
return;
72-
}
73-
74-
if (T.current) {
75-
T.results.push(T.current);
76-
console.log('');
77-
}
78-
79-
var test = F.tests.tests.shift();
80-
if (test == null) {
81-
82-
console.log('===================== RESULTS ======================');
83-
console.log('');
84-
console.log('> Passed .........', T.countok + '/' + T.count);
85-
console.log('> Failed ' + (T.countno ? '[x] .....' : '.........'), T.countno + '/' + T.count);
86-
console.log('');
87-
88-
F.isTest = false;
89-
F.emit('test-end', T);
90-
91-
// DONE
92-
setTimeout(function() {
93-
F.kill(T.countno ? 1 : 0);
94-
}, 1000);
95-
96-
} else {
97-
98-
T.current = test;
99-
T.current.results = [];
100-
101-
console.log('[ TEST: ' + test.filename.substring(F.path.root('/tests/').length) + (T.current.priority ? ' ({0}) ]'.format(T.current.priority) : ' ]'));
102-
console.log('');
103-
104-
NEXT();
105-
}
106-
};
107-
108108
exports.load = function() {
109109
U.ls(F.path.root('/tests/'), function(files) {
110110
files.waitFor(function(filename, next) {

0 commit comments

Comments
 (0)