forked from mad-eye/meteor-mocha-web
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testReport.js
44 lines (37 loc) · 1.14 KB
/
testReport.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
var MochaWebTests = null
var MochaWebTestReports = null
Meteor.startup(function(){
MochaWebTests = new Meteor.Collection("mochaWebTests");
MochaWebTestReports = new Meteor.Collection("mochaWebTestReports");
MochaWebSuites = new Meteor.Collection("mochaWebSuites");
Meteor.subscribe("mochaServerSideTests", {includeAll: true});
Meteor.subscribe("mochaServerSideTestReports");
Meteor.subscribe("mochaServerSideSuites");
});
Template.serverTestReport.helpers({
failedTests: function(){
return MochaWebTests.find({state: "failed"});
},
testReport: function(){
return MochaWebTestReports.findOne();
},
rootSuites: function(){
var rootSuites = [];
//TODO add sort
return MochaWebSuites.find({parentSuiteId: null});
}
});
Template.mochaTestObject.helpers({
children: function(){
var suites = MochaWebSuites.find({parentSuiteId: this._id}).fetch();
var tests = MochaWebTests.find({parentSuiteId: this._id}).fetch();
return tests.concat(suites);
},
stateClass: function(){
if (this.state == "passed")
return "pass";
if (this.state == "failed")
return "fail";
return this.state;
}
})