forked from schorfES/node-junitwriter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestbase.js
More file actions
54 lines (41 loc) · 965 Bytes
/
Testbase.js
File metadata and controls
54 lines (41 loc) · 965 Bytes
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
var
merge = require('merge'),
Node = require('./Node')
;
function Testbase(nodeName, parent) {
Node.call(this, nodeName, parent);
}
Testbase.prototype = Object.create(Node.prototype);
merge(Testbase.prototype, {
incAttr: function(attr, amount) {
var
name = '_attr_' + attr,
count = (this[name] || 0) + (amount || 1)
;
this[name] = count;
this.node.attribute(attr, count);
return this;
},
incDisabled: function(amount) {
return this.incAttr('disabled', amount);
},
incErrors: function(amount) {
return this.incAttr('errors', amount);
},
incFailures: function(amount) {
return this.incAttr('failures', amount);
},
incTests: function(amount) {
return this.incAttr('tests', amount);
},
setTime: function(seconds) {
this.node.attribute('time', seconds);
},
setName: function(name) {
this.node.attribute('name', name);
},
toString: function() {
return this.node.toString();
}
});
module.exports = Testbase;