This repository has been archived by the owner on Jun 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtdd.console.js
93 lines (89 loc) · 2.15 KB
/
tdd.console.js
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
// @ts-nocheck
/***
* For `js` Object in Max
*/
if (!String.prototype.startsWith) {
Object.defineProperty(String.prototype, 'startsWith', {
value: function(search, pos) {
pos = !pos || pos < 0 ? 0 : +pos;
return this.substring(pos, pos + search.length) === search;
}
});
}
var console = {
log: function() {
for (var i = 0, len = arguments.length; i < len; i++) {
var message = arguments[i];
if (message && message.toString) {
var s = message.toString();
if (s.indexOf('[object ') >= 0) {
s = JSON.stringify(message);
}
post(s);
} else if (message === null) {
post('<null>');
} else {
post(message);
}
}
post('\n');
},
error: function() {
for (var i = 0, len = arguments.length; i < len; i++) {
var message = arguments[i];
if (message && message.toString) {
var s = message.toString();
if (s.indexOf('[object ') >= 0) {
s = JSON.stringify(message);
}
error(s);
} else if (message === null) {
error('<null>');
} else {
error(message);
}
}
error('\n');
}
};
function print(input) {
if (input.startsWith('stderr')) {
console.error(input.replace('stderr ', ''))
return;
}
const msg = input.replace('stdout ', '');
if (msg.startsWith('Starting')) {
console.log(
'///////////////////////////////////////////////////////////////'
);
console.log('TDD-MAX');
console.log(
'///////////////////////////////////////////////////////////////'
);
return;
}
if (msg.startsWith('Running')) {
console.log('===========================');
console.log(msg);
return;
}
if (msg.startsWith('Passed')) {
console.log(' # ' + msg);
return;
}
if (msg.startsWith('Init')) {
console.log(' - ' + msg);
return;
}
if (msg.startsWith('Finished')) {
console.log(
'///////////////////////////////////////////////////////////////'
);
console.log(msg);
console.log(
'///////////////////////////////////////////////////////////////'
);
return;
}
console.log(msg);
}