Sha256: cf03c72fa5062802a46c3a909cdf5c9eb992efffab152fd46c3c9adea0f0f4fb

Contents?: true

Size: 1.58 KB

Versions: 1

Compression:

Stored size: 1.58 KB

Contents

// ==========================================================================
// Project:   SproutCore Unit Testing Library
// Copyright: ©2006-2009 Sprout Systems, Inc. and contributors.
//            Portions ©2008-2009 Apple Inc. All rights reserved.
// License:   Licened under MIT license (see license.js)
// ==========================================================================
/*globals __module */

var Ct = require('./core');

/**
  The test runner allows you to register one or more modules.  It will then
  step through the modules, requiring each one.  If run in the browser it 
  can optionally look at the href and filter.
*/
var Runner = function() {
  this.modules = [];
};

var Rp = Runner.prototype;

/**
  Pass one or more module ids.  
*/
Rp.register = function(args) {
  var len = arguments.length, idx;
  for(idx=0;idx<len;idx++) {
    var mod = arguments[idx];
    if ('string' === typeof mod) this.modules.push(mod);
    else mod.forEach(function(m) { this.modules.push(m); }, this);
  }
  return this;
};

/**
  Filters the current set of modules based on the href.  
  TODO: implement
*/
Rp.filter = function() {
  
};

Rp.finish = function() {
  console.log('finished');
};

Rp.run = function() {
  this.filter();
  
  this.modules.forEach(function(m) { 
    var sb = require.sandbox(false); // TODO: Use isolated sandboxes
    var sbCt = sb.require('core-test');

    sbCt.defaultLogger = Ct.defaultLogger; // share logger
    sb.require(m); 
    sbCt.run();
  });
  
  Ct.then(this, this.finish);
  Ct.run();
};

__module.exports = exports = new Runner();
exports.Runner = Runner;

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spade-0.0.1 packages/core-test/lib/runner.js