Permalink
Browse files

add more unit tests for cli mojito test

  • Loading branch information...
1 parent 68fd423 commit e375af52db3d177d44db3d2528f2ac2d594fa8dc Lichun Zhan committed Jan 31, 2013
@@ -201,7 +201,7 @@ function consoleTestReport(results, allFailures) {
function printTestSuiteResults(suite) {
if (inputOptions.verbose) {
- utils.log('suite: ' + suite.name);
+ console.log('suite: ' + suite.name);
}
var caseName,
testThing;
@@ -256,7 +256,7 @@ function consoleTestReport(results, allFailures) {
}
report = report + formatter(percentagePassed + '% pass rate') + '\n';
- console.log(report);
+ utils.log(report);
}
@@ -704,25 +704,37 @@ function run(params, opts) {
testName = params[2] || '';
if (!dir) {
utils.error('Please specify ' + testOption + ' directory to test.',
- usage,
- true
+ usage
);
+ return;
}
try {
stat = libfs.statSync(dir);
if (!stat.isDirectory()) {
- utils.error('"' + dir + '" is not a directory.', usage, true);
+ utils.error('"' + dir + '" is not a directory.', usage);
+ return;
}
} catch (err) {
- utils.error('Invalid directory: \'' + dir + '\'', usage, true);
+ utils.error('Invalid directory: \'' + dir + '\'', usage);
+ return;
}
runTests({path: dir, type: testOption, name: testName});
} else {
- utils.error('Please specify test type "app" or "mojit".', usage, true);
+ utils.error('Please specify test type "app" or "mojit".', usage);
+ return;
}
}
+function setForTest(opts) {
+ inputOptions = opts;
+}
-
+function getForTest() {
+ var testresult = {
+ collectedFailures: collectedFailures,
+ collectedResults: collectedResults
+ };
+ return testresult;
+}
/**
* Add ability to skip tests without breaking.
*/
@@ -758,3 +770,14 @@ exports.options = [
hasValue: true
}
];
+
+exports.test = {
+ collectFailure: collectFailure,
+ collectRunResults: collectRunResults,
+ colorFactory: colorFactory,
+ preProcessor: preProcessor,
+ consoleTestReport: consoleTestReport,
+ merge: merge,
+ setForTest: setForTest,
+ getForTest: getForTest
+};
@@ -15,6 +15,14 @@
},
"group": "fw,unit,server"
},
+ "test.js": {
+ "params": {
+ "test": "./test-test.js",
+ "lib": "$$config.mojitodir$$/lib/app/commands/test.js",
+ "driver": "nodejs"
+ },
+ "group": "fw,unit,server"
+ },
"info.js": {
"params": {
"test": "./test-info.js",
Oops, something went wrong. Retry.

0 comments on commit e375af5

Please sign in to comment.