/*jslint indent: 2, nomen: true, maxlen: 120, regexp: true, todo: true */
/*global module, require, exports, print */

var runTest = require('jsunity').runTest,
  _ = require('underscore'),
  internal = require('internal'),
  runJSUnityTests,
  runJasmineTests,
  runCommandLineTests;

////////////////////////////////////////////////////////////////////////////////
/// @brief runs all jsunity tests
////////////////////////////////////////////////////////////////////////////////

runJSUnityTests = function (tests) {
  'use strict';
  var result = true;

  _.each(tests, function (file) {
    print("\nRunning JSUnity test from file '" + file + "'");

    try {
      result = result && runTest(file);
    } catch (err) {
      print("cannot run test file '" + file + "': " + err);
      print(err.stack);
      result = false;
    }

    internal.wait(0); // force GC
  });

  return result;
};

////////////////////////////////////////////////////////////////////////////////
/// @brief runs all jsunity tests
////////////////////////////////////////////////////////////////////////////////

runJasmineTests = function (testFiles) {
  'use strict';
  var result = true;

  if (testFiles.length > 0) {
    print('\nRunning Jasmine Tests: ' + testFiles.join(', '));
    result = require('jasmine').executeTestSuite(testFiles, { format: 'progress' });
  }

  return result;
};

////////////////////////////////////////////////////////////////////////////////
/// @brief runs tests from command-line
////////////////////////////////////////////////////////////////////////////////

runCommandLineTests = function () {
  'use strict';
  var result = true,
    unitTests = internal.unitTests(),
    isSpecRegEx = /.+spec.js/,
    isSpec = function (unitTest) {
      return isSpecRegEx.test(unitTest);
    },
    jasmine = _.filter(unitTests, isSpec),
    jsUnity = _.reject(unitTests, isSpec);

  result = runJSUnityTests(jsUnity) && runJasmineTests(jasmine);

  internal.setUnitTestsResult(result);
};

exports.runCommandLineTests = runCommandLineTests;

@@ -1127,16 +1127,25 @@
 estFiles
+, options
 ) %7B%0A  'u
@@ -1335,30 +1335,15 @@
 es, 
-%7B format: 'progress' %7D
+options
 );%0A 
@@ -1602,16 +1602,20 @@
 nction (
+opts
 ) %7B%0A  'u
@@ -1647,16 +1647,111 @@
 = true,%0A
+    options = opts %7C%7C %7B%7D,%0A    jasmineReportFormat = options.jasmineReportFormat %7C%7C 'progress',%0A
     unit
@@ -2043,16 +2043,49 @@
 (jasmine
+, %7B format: jasmineReportFormat %7D
 );%0A%0A  in

Make the output format configurable from the outside