in jones-test/lib/Suite.js [111:177]
Suite.prototype.createTests = function() {
var stat, suite, i;
udebug.log_detail("createTests for", this.name, "in", this.path);
if(this.path.length) {
stat = fs.statSync(this.path);
if(stat.isFile()) {
var testFile = this.path;
this.path = path.dirname(testFile);
try {
this.addTestsFromFile("SmokeTest.js", null);
} catch(ignore) {}
this.addTestsFromFile(testFile, this.driver.testInFile);
try {
this.addTestsFromFile("ClearSmokeTest.js", null);
} catch(ignore) {}
}
else if(stat.isDirectory()) {
var files = fs.readdirSync(this.path);
for(i = 0; i < files.length ; i++) {
this.addTestsFromFile(files[i], null);
}
}
}
this.tests.forEach(function(t, index) {
t.original = index;
});
this.tests.sort(function(a,b) {
// sort the tests by phase, preserving the original order within each phase
if(a.phase < b.phase) { return -1; }
if(a.phase === b.phase) { return (a.original < b.original)?-1:1; }
return 1;
});
suite = this;
this.tests.forEach(function(t, index) {
t.index = index;
t.suite = suite;
switch(t.phase) {
case 0:
suite.smokeTest = t;
break;
case 1:
suite.concurrentTests.push(t);
if (suite.firstConcurrentTestIndex === -1) {
suite.firstConcurrentTestIndex = t.index;
}
break;
case 2:
suite.serialTests.push(t);
if (suite.firstSerialTestIndex === -1) {
suite.firstSerialTestIndex = t.index;
}
break;
case 3:
suite.clearSmokeTest = t;
break;
}
});
this.numberOfConcurrentTests = this.concurrentTests.length;
this.numberOfSerialTests = this.serialTests.length;
udebug.log_detail("Suite", this.name, "has",
this.numberOfConcurrentTests, "concurrent tests;",
this.numberOfSerialTests, "serial tests.");
};