mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
When switching test sets, treat it like a hot code push
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
body {
|
||||
padding-top: 40px;
|
||||
padding-bottom: 40px;
|
||||
}
|
||||
|
||||
#testProgressBar {
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
<div class="navbar navbar-fixed-top navbar-inverse">
|
||||
<div class="navbar-inner">
|
||||
<div class="row-fluid">
|
||||
<div class="span2 offset1"><a class="brand" href="#">
|
||||
<div class="span3"><a class="brand" href="#">
|
||||
|
||||
{{#if running}}
|
||||
Testing in progress...
|
||||
{{else}}
|
||||
@@ -36,7 +37,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{{> groupNav}}
|
||||
<div class="row-fluid"><div class="span11 offset1">
|
||||
<div class="row-fluid"><div class="span12">
|
||||
<ul class="failedTests">
|
||||
{{#each failedTests}}
|
||||
<li>{{this}}</li>
|
||||
@@ -63,6 +64,7 @@
|
||||
<div class="navbar-inner">
|
||||
<ul class="nav">
|
||||
{{#each groupPaths}}
|
||||
<li class="navbar-text"> - </li>
|
||||
<li><a class="group" href="#">{{name}}</a></li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
|
||||
@@ -1,42 +1,26 @@
|
||||
var running;
|
||||
var running = true;
|
||||
|
||||
var groupPathDeps;
|
||||
var groupPath;
|
||||
var resultTree;
|
||||
var failedTests;
|
||||
var resultDeps;
|
||||
var countDeps;
|
||||
var totalCount;
|
||||
var passedCount;
|
||||
var failedCount;
|
||||
var resetTests = function () {
|
||||
if (!Session.get("groupPath"))
|
||||
Session.set("groupPath", []);
|
||||
resultTree = [];
|
||||
failedTests = [];
|
||||
resultDeps = new Meteor.deps._ContextSet;
|
||||
countDeps = new Meteor.deps._ContextSet;
|
||||
totalCount = 0;
|
||||
passedCount = 0;
|
||||
failedCount = 0;
|
||||
var resultTree = [];
|
||||
var failedTests = [];
|
||||
var resultDeps = new Meteor.deps._ContextSet;
|
||||
var countDeps = new Meteor.deps._ContextSet;
|
||||
var totalCount = 0;
|
||||
var passedCount = 0;
|
||||
var failedCount = 0;
|
||||
|
||||
if (!Session.get("groupPath"))
|
||||
Session.set("groupPath", ["tinytest"]);
|
||||
|
||||
running = true;
|
||||
};
|
||||
resetTests();
|
||||
Meteor.startup(function () {
|
||||
rerunTests();
|
||||
});
|
||||
|
||||
var rerunTests = function () {
|
||||
countDeps.invalidateAll();
|
||||
_resultsChanged();
|
||||
Meteor.flush();
|
||||
Meteor._runTestsEverywhere(reportResults, function () {
|
||||
running = false;
|
||||
Meteor.onTestsComplete && Meteor.onTestsComplete();
|
||||
_resultsChanged();
|
||||
Meteor.flush();
|
||||
}, Session.get("groupPath"));
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
Template.progressBar.running = function () {
|
||||
countDeps.addCurrentContext();
|
||||
@@ -71,16 +55,22 @@ Template.groupNav.groupPaths = function () {
|
||||
return ret;
|
||||
};
|
||||
|
||||
var changeToPath = function (path) {
|
||||
Session.set("groupPath", path);
|
||||
// pretend there's just been a hot code push
|
||||
// so we run the tests completely fresh.
|
||||
Meteor._reload.reload();
|
||||
};
|
||||
|
||||
Template.groupNav.events({
|
||||
"click .group": function () {
|
||||
console.log("clicked", this);
|
||||
Session.set("groupPath", this.path);
|
||||
changeToPath(this.path);
|
||||
}
|
||||
});
|
||||
|
||||
Template.test_group.events({
|
||||
"click .groupname": function () {
|
||||
Session.set("groupPath", this.path);
|
||||
changeToPath(this.path);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -321,15 +311,21 @@ var _findTestForResults = function (results) {
|
||||
}
|
||||
|
||||
var group;
|
||||
var i = 0;
|
||||
_.each(groupPath, function(gname) {
|
||||
var array = (group ? (group.groups || (group.groups = []))
|
||||
: resultTree);
|
||||
var newGroup = _.find(array, function(g) { return g.name === gname; });
|
||||
if (! newGroup) {
|
||||
newGroup = {name: gname, parent: (group || null), path: groupPath}; // create group
|
||||
newGroup = {
|
||||
name: gname,
|
||||
parent: (group || null),
|
||||
path: groupPath.slice(0, i+1)
|
||||
}; // create group
|
||||
array.push(newGroup);
|
||||
}
|
||||
group = newGroup;
|
||||
i++;
|
||||
});
|
||||
|
||||
var testName = results.test;
|
||||
|
||||
Reference in New Issue
Block a user